[wp-trac] Re: [WordPress Trac] #2828: Ease MySQL4.1 character set configuration

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 4 15:15:45 GMT 2006


#2828: Ease MySQL4.1 character set configuration
---------------------------+------------------------------------------------
 Reporter:  tenpura        |        Owner:  tenpura 
     Type:  enhancement    |       Status:  assigned
 Priority:  high           |    Milestone:  2.2     
Component:  General        |      Version:  2.1     
 Severity:  normal         |   Resolution:          
 Keywords:  needs-testing  |  
---------------------------+------------------------------------------------
Comment (by lelion):

 I used: [[BR]]

 {{{
 mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'");
 }}}

 after line 43 in wp-includes/wp-db.php, to resolve the following poblem:
 [[BR]]
 1) Create a new empty database, set collation to: utf8_unicode_ci (in
 OPERATIONS tab, phpMyAdmin)[[BR]]
 2) Create a new WP blog, clean install (2.05)[[BR]]
 3) Set UTF-8 as encoding in WP admin panel[[BR]]
 4) Basically, everywhere all is UTF-8 (Unicode) and... [[BR]]
 5) In the website posts written in both English and Bulgarian languages
 look OK, but... [[BR]]
 5) When I log in into PHP MyAdmin and open the WP table with the posts, I
 see strange signs ("gibberish";-) instead of Cyrillic characters. So text
 CANNOT be read normally from the database, only from the website. This
 could badly impact future upgrades, backup/restore of the MySQL database.
 [[BR]]
 6) To fix this, I tried the following "hack": [[BR]]
 Open wp-includes/wp-db.php, add the following code after line 43: [[BR]]
 {{{
 mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'");
 }}}
 After that, EVERYTHING I have posted in Bulgarian (Cyrillic characters)
 appeared correct BOTH in the website and the database!  [[BR]]

 It's a pity, one cannot over-ride default encoding settings using .my.cnf
 in shared hosting environment, to fix this globally :( [[BR]]

 // [[BR]]

 But I guess, the above fix proposed (modifications to
 wp-config-sample.php and wp-settings.php) is a cleaner way to achive the
 same effect, right? [[BR]]

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2828#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list