Skip to content

Instantly share code, notes, and snippets.

@fabiancarlos
Created August 6, 2012 01:27
Show Gist options
  • Save fabiancarlos/3268851 to your computer and use it in GitHub Desktop.
Save fabiancarlos/3268851 to your computer and use it in GitHub Desktop.
Force charset utf8
<?php
mysql_connect("$hostname_config", "$username_config", "$password_config") or die(mysql_error());
$db = mysql_select_db("$database_config") or die(mysql_error());
mysql_query("SET NAMES 'utf8'");
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_results=utf8');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment