Web Hosting Talk







View Full Version : Why Mysql doesn't support UTF-8?


treotan
09-10-2005, 12:21 AM
My Cobalt Raq550 installed Mysql 4.1.12 with j2sdk1.4.2. I need using java program to make a insert statement to the Mysql db. I did make a db - default character set utf-8.

But It can't be done. The ssh console shown wrong character. Why?

I use the same setting and version of jdk and mysql in Window XP, it doesn't this problem. Why? Is it related the OS problem?


THKS

BruceT
09-10-2005, 12:48 AM
I know that MySQL 4.1.x requires configuration, either during the compilation, or in the database/table settings, to specify locale. Did you double-check (via phpMyAdmin or something) that your tables etc are actually configured to use UTF-8 and not the default (latin1_swedish_ci I think)?

Also, I've never done a database call from Java. Do you need to specify anything in the query etc that dictates the locale??

treotan
09-10-2005, 05:46 AM
I check the table format and the field properties, it is same configuration to the Window XP! I don't know why it can't be see chinese UTF-8? Is it related the OS? or it is only the Mysql wrong configuration?

BruceT
09-10-2005, 05:55 AM
No, there isn't anything in the Linux OS that I know of which would affect the locale/character set used in a specific MySQL database/ table/ field. That setting is configured in the db/table/field directly.

MySQL can be compiled to use any specific locale/character set by default, but that can be overridden by setting the property at the database/table/field level. That is done solely in MySQL, and not in the operating system.

So it really shouldn't matter what MySQL's default locale is set to, as long as your db/tables/fields are set properly.

See the MySQL docs (http://dev.mysql.com/doc/mysql/en/charset-upgrading.html) regarding changes you might need to do. I know that I had some problems in the past porting a 4.0.x database to 4.1.x because I didn't read the docs first, and just compiled the new MySQL and expected everything to "just work." And it doesn't. You have to pay special attention to the locale/character set being used at several steps during the configuration and use of MySQL.

treotan
09-10-2005, 06:36 AM
But I want to know why the console-ssh also can't be see the proper character set? my java program will display the insert data on console. On the other hands, the Window XP can display the correct character set in console-dos. Why>?

treotan
09-10-2005, 07:39 AM
I can't find the phpmyadmin.pkg for my machine Raq3i installed OS 550. Could you tell me where i canfind or install it manually?

I installed php:
[root web]# rpm -q php
php-4.0.6-C5_RaQ550

BruceT
09-10-2005, 01:17 PM
Originally posted by treotan
But I want to know why the console-ssh also can't be see the proper character set? my java program will display the insert data on console. On the other hands, the Window XP can display the correct character set in console-dos. Why>?

Is the console application you're using able to show alternate character sets? Some of the more simple ones might not support them. I have no experience with using alternate charsets, especially at the command line, though. Sorry.

BruceT
09-10-2005, 01:20 PM
Originally posted by treotan
I can't find the phpmyadmin.pkg for my machine Raq3i installed OS 550. Could you tell me where i canfind or install it manually?

I installed php:
[root web]# rpm -q php
php-4.0.6-C5_RaQ550

You can install it manually pretty easily. Just open up the tarball in one of your site's web directories, edit the config.inc.php file to insert your hostname, authentication method, etc., and that's all there is to it.

It can be slightly trickier to install it so that every virtual site on the RaQ can get access to it; you have to install phpMyAdmin in a neutral location (like under /home), then make an Alias entry in httpd.conf redirecting any request for /phpmyadmin/ to /home/phpmyadmin/. Then stop and restart Apache, and you should be good to go.

There are PKGs available from Nuonce.net and CobaltSupport.com I think as well.

treotan
09-11-2005, 06:12 AM
Hi! BruceT,
Could you tell more about the configuration of httpd.conf? I found it from /etc/httpd/conf/httpd.conf. But I can't find where is redirecting....! Thanks
I installed RaQ550-phpMyAdmin-2.5.7.pkg. and it located /home/phpmyadmin.

Thks

BruceT
09-11-2005, 11:52 AM
Sorry, not sure I know what you mean by "where is it redirecting"