The Cyrillic character sets and collations are for use with Belarusian, Bulgarian, Russian, Ukrainian, and Serbian (Cyrillic) languages.
cp1251
(Windows Cyrillic) collations:
cp1251_bin
cp1251_bulgarian_ci
cp1251_general_ci
(default)
cp1251_general_cs
cp1251_ukrainian_ci
cp866
(DOS Russian) collations:
cp866_bin
cp866_general_ci
(default)
koi8r
(KOI8-R Relcom Russian)
collations:
koi8r_bin
koi8r_general_ci
(default)
koi8u
(KOI8-U Ukrainian) collations:
koi8u_bin
koi8u_general_ci
(default)
For additional information about Cyrillic collations in MySQL, see Collation-Charts.Org (cp1251, cp866, koi8r, koi8u). ).
User Comments
I can't make it work showing Cyrillic when retriving from MySQL data. Showing ?????????????. I did everithing whatever is showing here but still nothing. Does anybody make it work please let me know how.
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;
maybe to make test with this:
-------------------test.php------------------------------------
<?php
$link = mysql_connect('localhost', 'user', 'pass');
if (!$link) {
printf("Connect failed: %s\n", mysql_error());
exit();
}
$charset = mysql_client_encoding($link);
printf ("Current character set is %s\n",$charset);
mysql_close($link);
?>
-------------------------------------------------------------------
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 ... !
Add your own comment.