For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > January 2005 > storing UNICODE in MySQL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author storing UNICODE in MySQL
aa

2005-01-13, 8:57 pm

Does MySGL allow storing text data in Unicode?
My web-host allows to enter data into a MySQL table using an HTML form which
accepts Cyrillics, but in the tablle all the Cyrillics is stored as entities
like &#xxxx;
Is this the problem of the SQL settings, ot is has to do with the encoding
of HTML page contasinin the form, which is not Unicode?
Or both?


J.O. Aho

2005-01-13, 8:57 pm

aa wrote:
> Does MySGL allow storing text data in Unicode?
> My web-host allows to enter data into a MySQL table using an HTML form which
> accepts Cyrillics, but in the tablle all the Cyrillics is stored as entities
> like &#xxxx;
> Is this the problem of the SQL settings, ot is has to do with the encoding
> of HTML page contasinin the form, which is not Unicode?
> Or both?


MySQL has some character setup settings, I guess a good page to get the info
you need would be http://dev.mysql.com/doc/mysql/en/Charset.html

Even if a character is sent coded, it is converted back in PHP, but not sure
if it automatically will handel utf-8, read more about that in the following
pages:

http://www.php.net/manual/en/function.utf8-decode.php
http://www.php.net/manual/en/function.utf8-encode.php
http://www.php.net/function.setlocale


//Aho
J.O. Aho

2005-01-14, 8:56 am

aa wrote:
> Thanks
>
> However my problem is not getting the data out of MySQL.
> My problem is how to force MySQL to store the data as Unicode. I know that
> MySQL is designed to handle Unicode and on my local computer MySQL
> downloaded from Internet does store data as Unicode.
>
> So the problem is with my web host - either they somehow set MySQL to use
> ANSI or the data are converted into ANSI on their way from the webpage to
> MySQL because the HTML page on which I enter the data, is ANSI.


Make a php script that has UTF-8 character that is stored into MySQL, run it
once and then check the entry in the table and see if it's modified or if it's
stored as it should be. If modified, then it's the MySQL that isn't set to
handle utf-8 (maybe they only support KOI).


//Aho
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com