Skip to content

Instantly share code, notes, and snippets.

@kathangeorg
Created October 25, 2012 10:53
Show Gist options
  • Save kathangeorg/3951989 to your computer and use it in GitHub Desktop.
Save kathangeorg/3951989 to your computer and use it in GitHub Desktop.
Contenido UTF8 Server MYSQL Umlaute
// in die conlib/db_mysql.inc
/* public: connection management */
function connect($Database = "", $Host = "", $User = "", $Password = "") {
/* Handle defaults */
if ("" == $Database)
$Database = $this->Database;
if ("" == $Host)
$Host = $this->Host;
if ("" == $User)
$User = $this->User;
if ("" == $Password)
$Password = $this->Password;
/* establish connection, select database */
if ( 0 == $this->Link_ID || !is_resource($this->Link_ID)) {
$this->Link_ID=@mysql_connect($Host, $User, $Password);
if (!$this->Link_ID) {
$this->halt("connect($Host, $User, \$Password) failed.");
return 0;
}
if ($this->Database != "")
{
if (!@mysql_select_db($Database,$this->Link_ID)) {
$this->halt("cannot use database ".$Database);
return 0;
}
}
}
// change from here
mysql_query('SET character_set_client = latin1');
mysql_query('SET character_set_results = latin1');
mysql_query('SET character_set_connection = latin1');
// to here
return $this->Link_ID;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment