Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Character encoding on web host's MySQL server



TLUG,

One of the web hosting services I use has PHP 5.2.5 and MySQL 4.1.16.

I should mention before continuing that the site is for a group I help out with, and the issue of changing hosting services is beyond my control. So I've got to work with what I've got for now.

Naturally, I want to make a site that displays Japanese text, and my preferred encoding is utf-8. And the web hosting service seems to have utf-8 supported... mostly.

I just uploaded a new version of the web site, with all new and much improved PHP code, and despite all indications that I have set everything to use utf-8, the Japanese characters are coming up as all question marks.

It is not surprising that I am seeing this problem now, because my previous web site version made do with storing Japanese as binary data, because it was originally built for a MySQL 3.2 system where utf-8 support was not very good. Now I want to get everything using more current, sensible, and uniform use of utf-8.

Looking in the phpMyAdmin interface for my webhost, I can see that some, but not all, of MySQL's system variables are set to use utf-8 for encoding and collation:

character set client        utf8
(Global value)            latin1
character set connection     utf8
(Global value)            latin1
character set database        latin1
character set results        utf8
(Global value)            latin1
character set server        latin1
character set system        utf8
character sets dir        /usr/share/mysql/charsets/
collation connection        utf8_unicode_ci
(Global value)            latin1_swedish_ci
collation database        latin1_swedish_ci
collation server        latin1_swedish_ci

On my home machine, where Japanese stored in MySQL works fine, I seem to have ensured that everything is set to use utf-8 by adding the following lines into my.cnf, under [mysqld]:

# utf8
init-connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake

But, on this particular web host, I don't have access to modify my.cnf.

So... my questions:

On my home machine, *all* of the above listed variables are set to use utf-8. But, in order to get proper utf-8 functionality, do I need to worry about all of them, or are some more critical than others?

I have emailed the web host support with most of the information here, requesting that utf-8 support be made more complete. However, in anticipation of the possibility that they can't comply because changing settings would adversely affect other clients, can I somehow modify my local environment enough to ensure proper functionality? If so, how?

Thank you for any advice.

--
Dave M G
http://www.tlug.jp/wiki/User:Dave_M_G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links