1.15 Converting Between Cyrillic Character Sets


You want to convert from one Cyrillic character set to another (for example, Windows to ISO).

Technique

Use the convert_cyr_string() to convert between Cyrillic character sets:

 $str = convert_cyr_string ($str, 'w', 'i'); 

Comments

The brothers and orthodox Slavonic monks Cyril and Methodius invented the Glagolitic script in Macedonia in the year 863 as an encrypted Greek alphabet with extensions for special Slavic sounds. The scholar Clement of Ohrid later invented the Cyrillic script as a more readable transformed Glagolitic alphabet. Over the course of centuries, the Cyrillic script was spread and transformed and it was modernized into its current Romanized shape (Grazhdanka) under Tsar Peter the Great.

Today, the Cyrillic script is used by more than 70 languages ranging from Eastern Europe's Slavic languages Russian (ru), Ukrainian (uk), Belarussian (be), Bulgarian (bg), Serbian (sr), and Macedonian (mk), through Central Asia's Altaic languages such as Azerbaijani (az), Turkmen (tk), Kurdish (ku), Uzbek (uz), Kazakh(kk), and Kirghiz (ky), to others such as Tajik (tg) and Mongolian (mn). Your library might have the 1965 booklet, "Alfavity jazykov narodov SSSR," by Kenesbai Musaevich Musaev. With a small accent -free alphabet, Russian and Bulgarian seemed equally well suited for computer processing as English.

The convert_cyr_string() function takes different Cyrillic character sets and converts them. In the earlier example, we took the Windows Cyrillic character (see Figure 1.1) and converted it into the ISO8859-5 character set (see Figure 1.2). A full list of supported conversions is available on the PHP Web site (http://www.php.net).

Figure 1.1. The Microsoft Cyrillic character set.

graphics/01fig01.gif

Figure 1.2. The ISO Cyrillic character set.

graphics/01fig02.gif



PHP Developer's Cookbook
PHP Developers Cookbook (2nd Edition)
ISBN: 0672323257
EAN: 2147483647
Year: 2000
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net