Anonymous Login
2019-10-20 21:42 PDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000587Pending RequestsCore Infrastructurepublic2014-08-16 18:21
Reportersciciphy 
Assigned Topedroa 
PrioritynormalSeverityminorReproducibilityN/A
StatusfeedbackResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000587: mysql can't read chinese
Descriptionenvironment:

centos 5.5
phpmyadmin 3.3.4
mysql 5.0.77


1. /etc/my.cnf
add
Code:

[mysqld]
default-character-set=utf8
init_connect="SET NAMES UTF8;"
[client]
default-character-set=utf8


2. go back to phpmyadmin, in Run SQL query/queries on server "localhost":
type
Code:
SHOW VARIABLES LIKE '%character%'


make sure you see
Code:
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server utf8
character_set_system utf8
character_sets_dir c:\wamp\bin\mysql\mysql5.1.36\share\charsets\


3. includes\db_adodb.php

Code:

function db_connect($host = 'localhost', $dbname, $user = 'root', $passwd = '', $persist = false) {
   global $db, $ADODB_FETCH_MODE;

   switch (strtolower(trim(w2PgetConfig('dbtype')))) {
      case 'oci8':
      case 'oracle':
         if ($persist) {
            $db->PConnect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
         } else {
            $db->Connect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
         }
         if (!defined('ADODB_ASSOC_CASE')) define('ADODB_ASSOC_CASE', 0);
         break;
      default:
      //mySQL
         if ($persist) {
            $db->PConnect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
         } else {
            $db->Connect($host, $user, $passwd, $dbname) or die('FATAL ERROR: Connection to database server failed');
         }
//////////////PLEASE ADD THIS CODE/////////////////////
         mysql_query("SET NAMES 'utf8'");
///////////////////////////////////////////////////////////////
   }

   $ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
}


then~ your mysql will display Chinese character properly now! congrat!!!
TagsNo tags attached.
Attached Files

-Relationships
related to 0000598feedbackcaseydk Pending Requests adodb-mysql does not set default character set for db connection, this can lead in unusable database content 
related to 0000632closedpedroa v2.3 Release (Closed) Print function produces wrong charaters 
+Relationships

-Notes

~0001320

pedroa (administrator)

Don't blame mysql, I can't read Chinese either :)

Can you please check if your web2Projects tables are encoded utf8?
Something like: utf8 COLLATE utf8_general_ci

Thanks,

Pedro A.

~0001374

caseydk (administrator)

sciciphy, any update on this one?

I don't know enough about character sets to be helpful..
+Notes

-Issue History
Date Modified Username Field Change
2010-09-29 21:38 sciciphy New Issue
2010-10-19 11:25 pedroa Status new => assigned
2010-10-19 11:25 pedroa Assigned To => pedroa
2010-10-26 06:33 pedroa Relationship added related to 0000598
2010-10-26 06:35 pedroa Note Added: 0001320
2010-10-26 06:35 pedroa Status assigned => feedback
2010-11-25 02:47 pedroa Relationship added related to 0000632
2010-11-26 07:25 caseydk Note Added: 0001374
2010-12-28 20:41 caseydk Category -- none specified -- => Core Infrastructure
2014-08-16 18:21 caseydk Category General => Core Infrastructure
+Issue History