User Comments

Imagine you have a table which has column 'name' in UTF-8 and column 'namew' in cp1251. Both columns have some cyrillic information in it. You use xterm with koi8r character set to work with your database. There are 3 steps you need to do to work with your table.

1. alter your table to include information about character sets that are used in your table (see section Converting 4.0 Character Columns to 4.1 Format). Most of us have to do this step because usually you inherit your tables from MySQL 4.0 If you created your table and specified character sets there is no need to do this step. Verify your actions using SHOW FULL COLUMNS FROM table_name.

2. SET NAMES KOI8R. (see section Connection Character Sets and Collations for details). It explains that your I/O is done in KOI8R

3. SELECT name,namew FROM table_name; Database will convert UTF8,cp1251--> koi8r for you and will produce results in koi8r character set that you can see on your terminal. You can also do UPDATE table_name SET name='koi8r-typed-russian-word' and database will convert your string that you typed in koi8r into UTF-8 format and store in your table.

so, i have a real estate web site www.capecana.com and we have database in 5 languages, one of them is russian. So why simple, when it can be compicated? First i gave my secretary access to myadmin so she can work with russian (Natasha), and we had trouble with russian characters...so again search machines, topics, forums etc. and it was the point with encoding ex. KOI8-R as it was used on Unix, its a table with a russian characters and on the top andon the left side you have a characters that are encoding one russian letter...mysql> SHOW CHARACTER SET;

| koi8r | KOI8-R Relcom Russian | koi8r_general_ci | 1 |

maybe to make test with this:-------------------test.php------------------------------------ <?php

It's true about the results like "???????" . In versions of PHP >5.0.* and MySQL 4.1.14 , and if you try to get result in cyrillic , you will see just "????". There is sample solution : immediately after mysql_connect() , and mysql_select_db() add this lines : mysql_query("SET NAMES CP1251");Thats all ... ! Good luck ... !