Problems with Japanese characters in MODx

August 5, 2010

Was having a problem with Japanese characters on a multi-lingual MODx site. I could see that the correct characters were being INSERTed into the database, but when I queried it directly after the insert I got just question marks out.

The solution was to change line 10 in manager/includes/config.inc.php from this:

$database_connection_method = ‘SET CHARACTER SET’;

to this:

$database_connection_method = ‘SET NAMES’;

The difference between ‘SET CHARACTER SET’ and ‘SET NAMES’ is ‘SET NAMES’ tells mysql server what character set is going to be used in the connection between the server and the client (rather than just what charset will be used on the server and on the client themselves). Because it wasn’t being used, the mysql server was just guessing the character set, and guessing it wrong.

Advertisements

One Response to “Problems with Japanese characters in MODx”


  1. […] includes / config.inc.php da questo: $ database_connection_method = 'SET CHARACTER […] From: Cormac’s php blog. Continue reading. Categorie:Senza categoria Tag: Commenti (0) Trackbacks (0) Lascia un […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: