CancelImage Upload

How to set different Content-Type Character Sets for Russian Cyrillic Alphabet in PHP

To choose between different Content-Types for Russian Cyrillic symbols in PHP we can use the function convert_cyr_string(). This function enables us to switch between the following character sets:

  • Windows-1251 = w
  • iso8859-5 = i
  • koi8-r = k
  • x-cp866 = a or d
  • x-mac-cyrillic = m

To carry the function out we need to specify the $string to be translated, the current character set, and the character set to be translated into:


$converted = convert_cyr_string($string, $from, $to);


Or rather:


$converted = convert_cyr_string($string, "k", "w");


Want to leave a comment?

No problem. Just enter your email and password below.

register | home | reminder

myDesignTool Networking •