Re: convert from UTF8 to EUC-JP

From: Date: Fri, 30 Jan 2004 23:26:29 +0000
Subject: Re: convert from UTF8 to EUC-JP
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-657@lists.php.net to get a copy of this message
On 2004/01/30, at 16:08, Ligaya Turmelle wrote:
OK I have a really basic question I hope. How do you have UTF8 data saved to a MySQL 4.0 database and then extract it and put it back into UTF8? Do I have to use the mb_convert_encoding($str, EUC_JP, UTF8) in PHP before the insert and the reverse after the select? I'm using UTF8 on the web page but the 4.0 version of MySQL doesn't support it ( Idiot me tested it in 4.1 not thinking so the whole project is designed in UTF8).
I think you'll be better off using MySQL 4.1 (still in Alpha), or the latest version of PostgreSQL, both of which natively supports UTF-8 character set. As a side note: often it appears possible to forcefully use UTF-8 in a table that is created to store strings of a character set different than UTF-8 because it actually work without any error, but it would result in some weird behaviour when you use SQL string manipulation functions / operators ("LIKE" / regex comparators) and FULLTEXT indexes with such a mismatched setting. In other words, you can use UTF-8 unless you are planning to use any of these features. It's anyway discouraged though. Moriyoshi

« previous php.i18n (#657) next »