Re: convert from UTF8 to EUC-JP

Moriyoshi Koizumi <[email protected]>
Newsgroups gmane.comp.php.internationalization
Message-ID <[email protected]>
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

-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.