From: tokul Date: Mon, 29 Sep 2003 09:44:42 +0000 (+0000) Subject: Adding decoding support for two DOSCyr charsets and several x-mac-* charsets. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=e9a71964b0904aaf43e44ae9968352f45e977ad0 Adding decoding support for two DOSCyr charsets and several x-mac-* charsets. Information is taken from ftp.unicode.org git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5791 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/decode/cp10000.php b/functions/decode/cp10000.php new file mode 100644 index 00000000..4da2ba4b --- /dev/null +++ b/functions/decode/cp10000.php @@ -0,0 +1,170 @@ + + * K.D. Chang + */ + +function charset_decode_cp10000 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'x-mac-roman') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp10000 = array( + "\0x80" => 'Ä', + "\0x81" => 'Å', + "\0x82" => 'Ç', + "\0x83" => 'É', + "\0x84" => 'Ñ', + "\0x85" => 'Ö', + "\0x86" => 'Ü', + "\0x87" => 'á', + "\0x88" => 'à', + "\0x89" => 'â', + "\0x8A" => 'ä', + "\0x8B" => 'ã', + "\0x8C" => 'å', + "\0x8D" => 'ç', + "\0x8E" => 'é', + "\0x8F" => 'è', + "\0x90" => 'ê', + "\0x91" => 'ë', + "\0x92" => 'í', + "\0x93" => 'ì', + "\0x94" => 'î', + "\0x95" => 'ï', + "\0x96" => 'ñ', + "\0x97" => 'ó', + "\0x98" => 'ò', + "\0x99" => 'ô', + "\0x9A" => 'ö', + "\0x9B" => 'õ', + "\0x9C" => 'ú', + "\0x9D" => 'ù', + "\0x9E" => 'û', + "\0x9F" => 'ü', + "\0xA0" => '†', + "\0xA1" => '°', + "\0xA2" => '¢', + "\0xA3" => '£', + "\0xA4" => '§', + "\0xA5" => '•', + "\0xA6" => '¶', + "\0xA7" => 'ß', + "\0xA8" => '®', + "\0xA9" => '©', + "\0xAA" => '™', + "\0xAB" => '´', + "\0xAC" => '¨', + "\0xAD" => '≠', + "\0xAE" => 'Æ', + "\0xAF" => 'Ø', + "\0xB0" => '∞', + "\0xB1" => '±', + "\0xB2" => '≤', + "\0xB3" => '≥', + "\0xB4" => '¥', + "\0xB5" => 'µ', + "\0xB6" => '∂', + "\0xB7" => '∑', + "\0xB8" => '∏', + "\0xB9" => 'π', + "\0xBA" => '∫', + "\0xBB" => 'ª', + "\0xBC" => 'º', + "\0xBD" => 'Ω', + "\0xBE" => 'æ', + "\0xBF" => 'ø', + "\0xC0" => '¿', + "\0xC1" => '¡', + "\0xC2" => '¬', + "\0xC3" => '√', + "\0xC4" => 'ƒ', + "\0xC5" => '≈', + "\0xC6" => '∆', + "\0xC7" => '«', + "\0xC8" => '»', + "\0xC9" => '…', + "\0xCA" => ' ', + "\0xCB" => 'À', + "\0xCC" => 'Ã', + "\0xCD" => 'Õ', + "\0xCE" => 'Œ', + "\0xCF" => 'œ', + "\0xD0" => '–', + "\0xD1" => '—', + "\0xD2" => '“', + "\0xD3" => '”', + "\0xD4" => '‘', + "\0xD5" => '’', + "\0xD6" => '÷', + "\0xD7" => '◊', + "\0xD8" => 'ÿ', + "\0xD9" => 'Ÿ', + "\0xDA" => '⁄', + "\0xDB" => '¤', + "\0xDC" => '‹', + "\0xDD" => '›', + "\0xDE" => 'fi', + "\0xDF" => 'fl', + "\0xE0" => '‡', + "\0xE1" => '·', + "\0xE2" => '‚', + "\0xE3" => '„', + "\0xE4" => '‰', + "\0xE5" => 'Â', + "\0xE6" => 'Ê', + "\0xE7" => 'Á', + "\0xE8" => 'Ë', + "\0xE9" => 'È', + "\0xEA" => 'Í', + "\0xEB" => 'Î', + "\0xEC" => 'Ï', + "\0xED" => 'Ì', + "\0xEE" => 'Ó', + "\0xEF" => 'Ô', + "\0xF0" => '￿', + "\0xF1" => 'Ò', + "\0xF2" => 'Ú', + "\0xF3" => 'Û', + "\0xF4" => 'Ù', + "\0xF5" => 'ı', + "\0xF6" => 'ˆ', + "\0xF7" => '˜', + "\0xF8" => '¯', + "\0xF9" => '˘', + "\0xFA" => '˙', + "\0xFB" => '˚', + "\0xFC" => '¸', + "\0xFD" => '˝', + "\0xFE" => '˛', + "\0xFF" => 'ˇ' + ); + + $string = str_replace(array_keys($cp10000), array_values($cp10000), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp10006.php b/functions/decode/cp10006.php new file mode 100644 index 00000000..b7d9f7d7 --- /dev/null +++ b/functions/decode/cp10006.php @@ -0,0 +1,170 @@ + + * K.D. Chang + */ + +function charset_decode_cp10006 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'x-mac-greek') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp10006 = array( + "\0x80" => 'Ä', + "\0x81" => '¹', + "\0x82" => '²', + "\0x83" => 'É', + "\0x84" => '³', + "\0x85" => 'Ö', + "\0x86" => 'Ü', + "\0x87" => '΅', + "\0x88" => 'à', + "\0x89" => 'â', + "\0x8A" => 'ä', + "\0x8B" => '΄', + "\0x8C" => '¨', + "\0x8D" => 'ç', + "\0x8E" => 'é', + "\0x8F" => 'è', + "\0x90" => 'ê', + "\0x91" => 'ë', + "\0x92" => '£', + "\0x93" => '™', + "\0x94" => 'î', + "\0x95" => 'ï', + "\0x96" => '•', + "\0x97" => '½', + "\0x98" => '‰', + "\0x99" => 'ô', + "\0x9A" => 'ö', + "\0x9B" => '¦', + "\0x9C" => '­', + "\0x9D" => 'ù', + "\0x9E" => 'û', + "\0x9F" => 'ü', + "\0xA0" => '†', + "\0xA1" => 'Γ', + "\0xA2" => 'Δ', + "\0xA3" => 'Θ', + "\0xA4" => 'Λ', + "\0xA5" => 'Ξ', + "\0xA6" => 'Π', + "\0xA7" => 'ß', + "\0xA8" => '®', + "\0xA9" => '©', + "\0xAA" => 'Σ', + "\0xAB" => 'Ϊ', + "\0xAC" => '§', + "\0xAD" => '≠', + "\0xAE" => '°', + "\0xAF" => '·', + "\0xB0" => 'Α', + "\0xB1" => '±', + "\0xB2" => '≤', + "\0xB3" => '≥', + "\0xB4" => '¥', + "\0xB5" => 'Β', + "\0xB6" => 'Ε', + "\0xB7" => 'Ζ', + "\0xB8" => 'Η', + "\0xB9" => 'Ι', + "\0xBA" => 'Κ', + "\0xBB" => 'Μ', + "\0xBC" => 'Φ', + "\0xBD" => 'Ϋ', + "\0xBE" => 'Ψ', + "\0xBF" => 'Ω', + "\0xC0" => 'ά', + "\0xC1" => 'Ν', + "\0xC2" => '¬', + "\0xC3" => 'Ο', + "\0xC4" => 'Ρ', + "\0xC5" => '≈', + "\0xC6" => 'Τ', + "\0xC7" => '«', + "\0xC8" => '»', + "\0xC9" => '…', + "\0xCA" => ' ', + "\0xCB" => 'Υ', + "\0xCC" => 'Χ', + "\0xCD" => 'Ά', + "\0xCE" => 'Έ', + "\0xCF" => 'œ', + "\0xD0" => '–', + "\0xD1" => '―', + "\0xD2" => '“', + "\0xD3" => '”', + "\0xD4" => '‘', + "\0xD5" => '’', + "\0xD6" => '÷', + "\0xD7" => 'Ή', + "\0xD8" => 'Ί', + "\0xD9" => 'Ό', + "\0xDA" => 'Ύ', + "\0xDB" => 'έ', + "\0xDC" => 'ή', + "\0xDD" => 'ί', + "\0xDE" => 'ό', + "\0xDF" => 'Ώ', + "\0xE0" => 'ύ', + "\0xE1" => 'α', + "\0xE2" => 'β', + "\0xE3" => 'ψ', + "\0xE4" => 'δ', + "\0xE5" => 'ε', + "\0xE6" => 'φ', + "\0xE7" => 'γ', + "\0xE8" => 'η', + "\0xE9" => 'ι', + "\0xEA" => 'ξ', + "\0xEB" => 'κ', + "\0xEC" => 'λ', + "\0xED" => 'μ', + "\0xEE" => 'ν', + "\0xEF" => 'ο', + "\0xF0" => 'π', + "\0xF1" => 'ώ', + "\0xF2" => 'ρ', + "\0xF3" => 'σ', + "\0xF4" => 'τ', + "\0xF5" => 'θ', + "\0xF6" => 'ω', + "\0xF7" => 'ς', + "\0xF8" => 'χ', + "\0xF9" => 'υ', + "\0xFA" => 'ζ', + "\0xFB" => 'ϊ', + "\0xFC" => 'ϋ', + "\0xFD" => 'ΐ', + "\0xFE" => 'ΰ', + "\0xFF" => '￿' + ); + + $string = str_replace(array_keys($cp10006), array_values($cp10006), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp10007.php b/functions/decode/cp10007.php new file mode 100644 index 00000000..2e288c4e --- /dev/null +++ b/functions/decode/cp10007.php @@ -0,0 +1,171 @@ + + * K.D. Chang + * + */ + +function charset_decode_cp10007 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'x-mac-cyrillic') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp10007 = array( + "\x80" => 'А', + "\x81" => 'Б', + "\x82" => 'В', + "\x83" => 'Г', + "\x84" => 'Д', + "\x85" => 'Е', + "\x86" => 'Ж', + "\x87" => 'З', + "\x88" => 'И', + "\x89" => 'Й', + "\x8A" => 'К', + "\x8B" => 'Л', + "\x8C" => 'М', + "\x8D" => 'Н', + "\x8E" => 'О', + "\x8F" => 'П', + "\x90" => 'Р', + "\x91" => 'С', + "\x92" => 'Т', + "\x93" => 'У', + "\x94" => 'Ф', + "\x95" => 'Х', + "\x96" => 'Ц', + "\x97" => 'Ч', + "\x98" => 'Ш', + "\x99" => 'Щ', + "\x9A" => 'Ъ', + "\x9B" => 'Ы', + "\x9C" => 'Ь', + "\x9D" => 'Э', + "\x9E" => 'Ю', + "\x9F" => 'Я', + "\xA0" => '†', + "\xA1" => '°', + "\xA2" => '¢', + "\xA3" => '£', + "\xA4" => '§', + "\xA5" => '•', + "\xA6" => '¶', + "\xA7" => 'І', + "\xA8" => '®', + "\xA9" => '©', + "\xAA" => '™', + "\xAB" => 'Ђ', + "\xAC" => 'ђ', + "\xAD" => '≠', + "\xAE" => 'Ѓ', + "\xAF" => 'ѓ', + "\xB0" => '∞', + "\xB1" => '±', + "\xB2" => '≤', + "\xB3" => '≥', + "\xB4" => 'і', + "\xB5" => 'µ', + "\xB6" => '∂', + "\xB7" => 'Ј', + "\xB8" => 'Є', + "\xB9" => 'є', + "\xBA" => 'Ї', + "\xBB" => 'ї', + "\xBC" => 'Љ', + "\xBD" => 'љ', + "\xBE" => 'Њ', + "\xBF" => 'њ', + "\xC0" => 'ј', + "\xC1" => 'Ѕ', + "\xC2" => '¬', + "\xC3" => '√', + "\xC4" => 'ƒ', + "\xC5" => '≈', + "\xC6" => '∆', + "\xC7" => '«', + "\xC8" => '»', + "\xC9" => '…', + "\xCA" => ' ', + "\xCB" => 'Ћ', + "\xCC" => 'ћ', + "\xCD" => 'Ќ', + "\xCE" => 'ќ', + "\xCF" => 'ѕ', + "\xD0" => '–', + "\xD1" => '—', + "\xD2" => '“', + "\xD3" => '”', + "\xD4" => '‘', + "\xD5" => '’', + "\xD6" => '÷', + "\xD7" => '„', + "\xD8" => 'Ў', + "\xD9" => 'ў', + "\xDA" => 'Џ', + "\xDB" => 'џ', + "\xDC" => '№', + "\xDD" => 'Ё', + "\xDE" => 'ё', + "\xDF" => 'я', + "\xE0" => 'а', + "\xE1" => 'б', + "\xE2" => 'в', + "\xE3" => 'г', + "\xE4" => 'д', + "\xE5" => 'е', + "\xE6" => 'ж', + "\xE7" => 'з', + "\xE8" => 'и', + "\xE9" => 'й', + "\xEA" => 'к', + "\xEB" => 'л', + "\xEC" => 'м', + "\xED" => 'н', + "\xEE" => 'о', + "\xEF" => 'п', + "\xF0" => 'р', + "\xF1" => 'с', + "\xF2" => 'т', + "\xF3" => 'у', + "\xF4" => 'ф', + "\xF5" => 'х', + "\xF6" => 'ц', + "\xF7" => 'ч', + "\xF8" => 'ш', + "\xF9" => 'щ', + "\xFA" => 'ъ', + "\xFB" => 'ы', + "\xFC" => 'ь', + "\xFD" => 'э', + "\xFE" => 'ю', + "\xFF" => '¤' + ); + + $string = str_replace(array_keys($cp10007), array_values($cp10007), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp10017.php b/functions/decode/cp10017.php new file mode 100644 index 00000000..77c63876 --- /dev/null +++ b/functions/decode/cp10017.php @@ -0,0 +1,169 @@ + 'А', + "\x81" => 'Б', + "\x82" => 'В', + "\x83" => 'Г', + "\x84" => 'Д', + "\x85" => 'Е', + "\x86" => 'Ж', + "\x87" => 'З', + "\x88" => 'И', + "\x89" => 'Й', + "\x8A" => 'К', + "\x8B" => 'Л', + "\x8C" => 'М', + "\x8D" => 'Н', + "\x8E" => 'О', + "\x8F" => 'П', + "\x90" => 'Р', + "\x91" => 'С', + "\x92" => 'Ґ', + "\x93" => 'У', + "\x94" => 'Ф', + "\x95" => 'Х', + "\x96" => 'Ц', + "\x97" => 'Ч', + "\x98" => 'Ш', + "\x99" => 'Щ', + "\x9A" => 'Ъ', + "\x9B" => 'Ы', + "\x9C" => 'Ь', + "\x9D" => 'Э', + "\x9E" => 'Ю', + "\x9F" => 'Я', + "\xA0" => '†', + "\xA1" => '°', + "\xA2" => '¢', + "\xA3" => '£', + "\xA4" => '§', + "\xA5" => '•', + "\xA6" => '¶', + "\xA7" => 'І', + "\xA8" => '®', + "\xA9" => '©', + "\xAA" => '™', + "\xAB" => 'Ђ', + "\xAC" => 'ђ', + "\xAD" => '≠', + "\xAE" => 'Ѓ', + "\xAF" => 'ѓ', + "\xB0" => '∞', + "\xB1" => '±', + "\xB2" => '≤', + "\xB3" => '≥', + "\xB4" => 'і', + "\xB5" => 'µ', + "\xB6" => '∂', + "\xB7" => 'Ј', + "\xB8" => 'Є', + "\xB9" => 'є', + "\xBA" => 'Ї', + "\xBB" => 'ї', + "\xBC" => 'Љ', + "\xBD" => 'љ', + "\xBE" => 'Њ', + "\xBF" => 'њ', + "\xC0" => 'ј', + "\xC1" => 'Ѕ', + "\xC2" => '¬', + "\xC3" => '√', + "\xC4" => 'ƒ', + "\xC5" => '≈', + "\xC6" => '∆', + "\xC7" => '«', + "\xC8" => '»', + "\xC9" => '…', + "\xCA" => ' ', + "\xCB" => 'Ћ', + "\xCC" => 'ћ', + "\xCD" => 'Ќ', + "\xCE" => 'ќ', + "\xCF" => 'ѕ', + "\xD0" => '–', + "\xD1" => '—', + "\xD2" => '“', + "\xD3" => '”', + "\xD4" => '‘', + "\xD5" => '’', + "\xD6" => 'ґ', + "\xD7" => '„', + "\xD8" => 'Ў', + "\xD9" => 'ў', + "\xDA" => 'Џ', + "\xDB" => 'џ', + "\xDC" => '№', + "\xDD" => 'Ё', + "\xDE" => 'ё', + "\xDF" => 'я', + "\xE0" => 'а', + "\xE1" => 'б', + "\xE2" => 'в', + "\xE3" => 'г', + "\xE4" => 'д', + "\xE5" => 'е', + "\xE6" => 'ж', + "\xE7" => 'з', + "\xE8" => 'и', + "\xE9" => 'й', + "\xEA" => 'к', + "\xEB" => 'л', + "\xEC" => 'м', + "\xED" => 'н', + "\xEE" => 'о', + "\xEF" => 'п', + "\xF0" => 'р', + "\xF1" => 'с', + "\xF2" => 'т', + "\xF3" => 'у', + "\xF4" => 'ф', + "\xF5" => 'х', + "\xF6" => 'ц', + "\xF7" => 'ч', + "\xF8" => 'ш', + "\xF9" => 'щ', + "\xFA" => 'ъ', + "\xFB" => 'ы', + "\xFC" => 'ь', + "\xFD" => 'э', + "\xFE" => 'ю', + "\xFF" => '¤' + ); + + $string = str_replace(array_keys($cp10017), array_values($cp10017), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp10029.php b/functions/decode/cp10029.php new file mode 100644 index 00000000..f7f45ecb --- /dev/null +++ b/functions/decode/cp10029.php @@ -0,0 +1,170 @@ + + * K.D. Chang + */ + +function charset_decode_cp10029 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'x-mac-centraleurroman') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp10029 = array( + "\0x80" => 'Ä', + "\0x81" => 'Ā', + "\0x82" => 'ā', + "\0x83" => 'É', + "\0x84" => 'Ą', + "\0x85" => 'Ö', + "\0x86" => 'Ü', + "\0x87" => 'á', + "\0x88" => 'ą', + "\0x89" => 'Č', + "\0x8A" => 'ä', + "\0x8B" => 'č', + "\0x8C" => 'Ć', + "\0x8D" => 'ć', + "\0x8E" => 'é', + "\0x8F" => 'Ź', + "\0x90" => 'ź', + "\0x91" => 'Ď', + "\0x92" => 'í', + "\0x93" => 'ď', + "\0x94" => 'Ē', + "\0x95" => 'ē', + "\0x96" => 'Ė', + "\0x97" => 'ó', + "\0x98" => 'ė', + "\0x99" => 'ô', + "\0x9A" => 'ö', + "\0x9B" => 'õ', + "\0x9C" => 'ú', + "\0x9D" => 'Ě', + "\0x9E" => 'ě', + "\0x9F" => 'ü', + "\0xA0" => '†', + "\0xA1" => '°', + "\0xA2" => 'Ę', + "\0xA3" => '£', + "\0xA4" => '§', + "\0xA5" => '•', + "\0xA6" => '¶', + "\0xA7" => 'ß', + "\0xA8" => '®', + "\0xA9" => '©', + "\0xAA" => '™', + "\0xAB" => 'ę', + "\0xAC" => '¨', + "\0xAD" => '≠', + "\0xAE" => 'ģ', + "\0xAF" => 'Į', + "\0xB0" => 'į', + "\0xB1" => 'Ī', + "\0xB2" => '≤', + "\0xB3" => '≥', + "\0xB4" => 'ī', + "\0xB5" => 'Ķ', + "\0xB6" => '∂', + "\0xB7" => '∑', + "\0xB8" => 'ł', + "\0xB9" => 'Ļ', + "\0xBA" => 'ļ', + "\0xBB" => 'Ľ', + "\0xBC" => 'ľ', + "\0xBD" => 'Ĺ', + "\0xBE" => 'ĺ', + "\0xBF" => 'Ņ', + "\0xC0" => 'ņ', + "\0xC1" => 'Ń', + "\0xC2" => '¬', + "\0xC3" => '√', + "\0xC4" => 'ń', + "\0xC5" => 'Ň', + "\0xC6" => '∆', + "\0xC7" => '«', + "\0xC8" => '»', + "\0xC9" => '…', + "\0xCA" => ' ', + "\0xCB" => 'ň', + "\0xCC" => 'Ő', + "\0xCD" => 'Õ', + "\0xCE" => 'ő', + "\0xCF" => 'Ō', + "\0xD0" => '–', + "\0xD1" => '—', + "\0xD2" => '“', + "\0xD3" => '”', + "\0xD4" => '‘', + "\0xD5" => '’', + "\0xD6" => '÷', + "\0xD7" => '◊', + "\0xD8" => 'ō', + "\0xD9" => 'Ŕ', + "\0xDA" => 'ŕ', + "\0xDB" => 'Ř', + "\0xDC" => '‹', + "\0xDD" => '›', + "\0xDE" => 'ř', + "\0xDF" => 'Ŗ', + "\0xE0" => 'ŗ', + "\0xE1" => 'Š', + "\0xE2" => '‚', + "\0xE3" => '„', + "\0xE4" => 'š', + "\0xE5" => 'Ś', + "\0xE6" => 'ś', + "\0xE7" => 'Á', + "\0xE8" => 'Ť', + "\0xE9" => 'ť', + "\0xEA" => 'Í', + "\0xEB" => 'Ž', + "\0xEC" => 'ž', + "\0xED" => 'Ū', + "\0xEE" => 'Ó', + "\0xEF" => 'Ô', + "\0xF0" => 'ū', + "\0xF1" => 'Ů', + "\0xF2" => 'Ú', + "\0xF3" => 'ů', + "\0xF4" => 'Ű', + "\0xF5" => 'ű', + "\0xF6" => 'Ų', + "\0xF7" => 'ų', + "\0xF8" => 'Ý', + "\0xF9" => 'ý', + "\0xFA" => 'ķ', + "\0xFB" => 'Ż', + "\0xFC" => 'Ł', + "\0xFD" => 'ż', + "\0xFE" => 'Ģ', + "\0xFF" => 'ˇ' + ); + + $string = str_replace(array_keys($cp10029), array_values($cp10029), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp10079.php b/functions/decode/cp10079.php new file mode 100644 index 00000000..212cd36c --- /dev/null +++ b/functions/decode/cp10079.php @@ -0,0 +1,170 @@ + + * K.D. Chang + */ + +function charset_decode_cp10079 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'x-mac-icelandic') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp10079 = array( + "\0x80" => 'Ä', + "\0x81" => 'Å', + "\0x82" => 'Ç', + "\0x83" => 'É', + "\0x84" => 'Ñ', + "\0x85" => 'Ö', + "\0x86" => 'Ü', + "\0x87" => 'á', + "\0x88" => 'à', + "\0x89" => 'â', + "\0x8A" => 'ä', + "\0x8B" => 'ã', + "\0x8C" => 'å', + "\0x8D" => 'ç', + "\0x8E" => 'é', + "\0x8F" => 'è', + "\0x90" => 'ê', + "\0x91" => 'ë', + "\0x92" => 'í', + "\0x93" => 'ì', + "\0x94" => 'î', + "\0x95" => 'ï', + "\0x96" => 'ñ', + "\0x97" => 'ó', + "\0x98" => 'ò', + "\0x99" => 'ô', + "\0x9A" => 'ö', + "\0x9B" => 'õ', + "\0x9C" => 'ú', + "\0x9D" => 'ù', + "\0x9E" => 'û', + "\0x9F" => 'ü', + "\0xA0" => 'Ý', + "\0xA1" => '°', + "\0xA2" => '¢', + "\0xA3" => '£', + "\0xA4" => '§', + "\0xA5" => '•', + "\0xA6" => '¶', + "\0xA7" => 'ß', + "\0xA8" => '®', + "\0xA9" => '©', + "\0xAA" => '™', + "\0xAB" => '´', + "\0xAC" => '¨', + "\0xAD" => '≠', + "\0xAE" => 'Æ', + "\0xAF" => 'Ø', + "\0xB0" => '∞', + "\0xB1" => '±', + "\0xB2" => '≤', + "\0xB3" => '≥', + "\0xB4" => '¥', + "\0xB5" => 'µ', + "\0xB6" => '∂', + "\0xB7" => '∑', + "\0xB8" => '∏', + "\0xB9" => 'π', + "\0xBA" => '∫', + "\0xBB" => 'ª', + "\0xBC" => 'º', + "\0xBD" => 'Ω', + "\0xBE" => 'æ', + "\0xBF" => 'ø', + "\0xC0" => '¿', + "\0xC1" => '¡', + "\0xC2" => '¬', + "\0xC3" => '√', + "\0xC4" => 'ƒ', + "\0xC5" => '≈', + "\0xC6" => '∆', + "\0xC7" => '«', + "\0xC8" => '»', + "\0xC9" => '…', + "\0xCA" => ' ', + "\0xCB" => 'À', + "\0xCC" => 'Ã', + "\0xCD" => 'Õ', + "\0xCE" => 'Œ', + "\0xCF" => 'œ', + "\0xD0" => '–', + "\0xD1" => '—', + "\0xD2" => '“', + "\0xD3" => '”', + "\0xD4" => '‘', + "\0xD5" => '’', + "\0xD6" => '÷', + "\0xD7" => '◊', + "\0xD8" => 'ÿ', + "\0xD9" => 'Ÿ', + "\0xDA" => '⁄', + "\0xDB" => '¤', + "\0xDC" => 'Ð', + "\0xDD" => 'ð', + "\0xDE" => 'Þ', + "\0xDF" => 'þ', + "\0xE0" => 'ý', + "\0xE1" => '·', + "\0xE2" => '‚', + "\0xE3" => '„', + "\0xE4" => '‰', + "\0xE5" => 'Â', + "\0xE6" => 'Ê', + "\0xE7" => 'Á', + "\0xE8" => 'Ë', + "\0xE9" => 'È', + "\0xEA" => 'Í', + "\0xEB" => 'Î', + "\0xEC" => 'Ï', + "\0xED" => 'Ì', + "\0xEE" => 'Ó', + "\0xEF" => 'Ô', + "\0xF0" => '￿', + "\0xF1" => 'Ò', + "\0xF2" => 'Ú', + "\0xF3" => 'Û', + "\0xF4" => 'Ù', + "\0xF5" => 'ı', + "\0xF6" => 'ˆ', + "\0xF7" => '˜', + "\0xF8" => '¯', + "\0xF9" => '˘', + "\0xFA" => '˙', + "\0xFB" => '˚', + "\0xFC" => '¸', + "\0xFD" => '˝', + "\0xFE" => '˛', + "\0xFF" => 'ˇ' + ); + + $string = str_replace(array_keys($cp10079), array_values($cp10079), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp10081.php b/functions/decode/cp10081.php new file mode 100644 index 00000000..fc892c0c --- /dev/null +++ b/functions/decode/cp10081.php @@ -0,0 +1,170 @@ + + * K.D. Chang + */ + +function charset_decode_cp10081 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'x-mac-turkish') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp10081 = array( + "\0x80" => 'Ä', + "\0x81" => 'Å', + "\0x82" => 'Ç', + "\0x83" => 'É', + "\0x84" => 'Ñ', + "\0x85" => 'Ö', + "\0x86" => 'Ü', + "\0x87" => 'á', + "\0x88" => 'à', + "\0x89" => 'â', + "\0x8A" => 'ä', + "\0x8B" => 'ã', + "\0x8C" => 'å', + "\0x8D" => 'ç', + "\0x8E" => 'é', + "\0x8F" => 'è', + "\0x90" => 'ê', + "\0x91" => 'ë', + "\0x92" => 'í', + "\0x93" => 'ì', + "\0x94" => 'î', + "\0x95" => 'ï', + "\0x96" => 'ñ', + "\0x97" => 'ó', + "\0x98" => 'ò', + "\0x99" => 'ô', + "\0x9A" => 'ö', + "\0x9B" => 'õ', + "\0x9C" => 'ú', + "\0x9D" => 'ù', + "\0x9E" => 'û', + "\0x9F" => 'ü', + "\0xA0" => '†', + "\0xA1" => '°', + "\0xA2" => '¢', + "\0xA3" => '£', + "\0xA4" => '§', + "\0xA5" => '•', + "\0xA6" => '¶', + "\0xA7" => 'ß', + "\0xA8" => '®', + "\0xA9" => '©', + "\0xAA" => '™', + "\0xAB" => '´', + "\0xAC" => '¨', + "\0xAD" => '≠', + "\0xAE" => 'Æ', + "\0xAF" => 'Ø', + "\0xB0" => '∞', + "\0xB1" => '±', + "\0xB2" => '≤', + "\0xB3" => '≥', + "\0xB4" => '¥', + "\0xB5" => 'µ', + "\0xB6" => '∂', + "\0xB7" => '∑', + "\0xB8" => '∏', + "\0xB9" => 'π', + "\0xBA" => '∫', + "\0xBB" => 'ª', + "\0xBC" => 'º', + "\0xBD" => 'Ω', + "\0xBE" => 'æ', + "\0xBF" => 'ø', + "\0xC0" => '¿', + "\0xC1" => '¡', + "\0xC2" => '¬', + "\0xC3" => '√', + "\0xC4" => 'ƒ', + "\0xC5" => '≈', + "\0xC6" => '∆', + "\0xC7" => '«', + "\0xC8" => '»', + "\0xC9" => '…', + "\0xCA" => ' ', + "\0xCB" => 'À', + "\0xCC" => 'Ã', + "\0xCD" => 'Õ', + "\0xCE" => 'Œ', + "\0xCF" => 'œ', + "\0xD0" => '–', + "\0xD1" => '—', + "\0xD2" => '“', + "\0xD3" => '”', + "\0xD4" => '‘', + "\0xD5" => '’', + "\0xD6" => '÷', + "\0xD7" => '◊', + "\0xD8" => 'ÿ', + "\0xD9" => 'Ÿ', + "\0xDA" => 'Ğ', + "\0xDB" => 'ğ', + "\0xDC" => 'İ', + "\0xDD" => 'ı', + "\0xDE" => 'Ş', + "\0xDF" => 'ş', + "\0xE0" => '‡', + "\0xE1" => '·', + "\0xE2" => '‚', + "\0xE3" => '„', + "\0xE4" => '‰', + "\0xE5" => 'Â', + "\0xE6" => 'Ê', + "\0xE7" => 'Á', + "\0xE8" => 'Ë', + "\0xE9" => 'È', + "\0xEA" => 'Í', + "\0xEB" => 'Î', + "\0xEC" => 'Ï', + "\0xED" => 'Ì', + "\0xEE" => 'Ó', + "\0xEF" => 'Ô', + "\0xF0" => '￿', + "\0xF1" => 'Ò', + "\0xF2" => 'Ú', + "\0xF3" => 'Û', + "\0xF4" => 'Ù', + "\0xF5" => '￿', + "\0xF6" => 'ˆ', + "\0xF7" => '˜', + "\0xF8" => '¯', + "\0xF9" => '˘', + "\0xFA" => '˙', + "\0xFB" => '˚', + "\0xFC" => '¸', + "\0xFD" => '˝', + "\0xFE" => '˛', + "\0xFF" => 'ˇ' + ); + + $string = str_replace(array_keys($cp10081), array_values($cp10081), $string); + + return $string; +} +?> \ No newline at end of file diff --git a/functions/decode/cp855.php b/functions/decode/cp855.php new file mode 100644 index 00000000..e8e219e8 --- /dev/null +++ b/functions/decode/cp855.php @@ -0,0 +1,170 @@ + + * K.D. Chang + */ + +function charset_decode_cp855 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'ibm855') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp855 = array( + "\x80" => 'ђ', + "\x81" => 'Ђ', + "\x82" => 'ѓ', + "\x83" => 'Ѓ', + "\x84" => 'ё', + "\x85" => 'Ё', + "\x86" => 'є', + "\x87" => 'Є', + "\x88" => 'ѕ', + "\x89" => 'Ѕ', + "\x8a" => 'і', + "\x8b" => 'І', + "\x8c" => 'ї', + "\x8d" => 'Ї', + "\x8e" => 'ј', + "\x8f" => 'Ј', + "\x90" => 'љ', + "\x91" => 'Љ', + "\x92" => 'њ', + "\x93" => 'Њ', + "\x94" => 'ћ', + "\x95" => 'Ћ', + "\x96" => 'ќ', + "\x97" => 'Ќ', + "\x98" => 'ў', + "\x99" => 'Ў', + "\x9a" => 'џ', + "\x9b" => 'Џ', + "\x9c" => 'ю', + "\x9d" => 'Ю', + "\x9e" => 'ъ', + "\x9f" => 'Ъ', + "\xa0" => 'а', + "\xa1" => 'А', + "\xa2" => 'б', + "\xa3" => 'Б', + "\xa4" => 'ц', + "\xa5" => 'Ц', + "\xa6" => 'д', + "\xa7" => 'Д', + "\xa8" => 'е', + "\xa9" => 'Е', + "\xaa" => 'ф', + "\xab" => 'Ф', + "\xac" => 'г', + "\xad" => 'Г', + "\xae" => '«', + "\xaf" => '»', + "\xb0" => '░', + "\xb1" => '▒', + "\xb2" => '▓', + "\xb3" => '│', + "\xb4" => '┤', + "\xb5" => 'х', + "\xb6" => 'Х', + "\xb7" => 'и', + "\xb8" => 'И', + "\xb9" => '╣', + "\xba" => '║', + "\xbb" => '╗', + "\xbc" => '╝', + "\xbd" => 'й', + "\xbe" => 'Й', + "\xbf" => '┐', + "\xc0" => '└', + "\xc1" => '┴', + "\xc2" => '┬', + "\xc3" => '├', + "\xc4" => '─', + "\xc5" => '┼', + "\xc6" => 'к', + "\xc7" => 'К', + "\xc8" => '╚', + "\xc9" => '╔', + "\xca" => '╩', + "\xcb" => '╦', + "\xcc" => '╠', + "\xcd" => '═', + "\xce" => '╬', + "\xcf" => '¤', + "\xd0" => 'л', + "\xd1" => 'Л', + "\xd2" => 'м', + "\xd3" => 'М', + "\xd4" => 'н', + "\xd5" => 'Н', + "\xd6" => 'о', + "\xd7" => 'О', + "\xd8" => 'п', + "\xd9" => '┘', + "\xda" => '┌', + "\xdb" => '█', + "\xdc" => '▄', + "\xdd" => 'П', + "\xde" => 'я', + "\xdf" => '▀', + "\xe0" => 'Я', + "\xe1" => 'р', + "\xe2" => 'Р', + "\xe3" => 'с', + "\xe4" => 'С', + "\xe5" => 'т', + "\xe6" => 'Т', + "\xe7" => 'у', + "\xe8" => 'У', + "\xe9" => 'ж', + "\xea" => 'Ж', + "\xeb" => 'в', + "\xec" => 'В', + "\xed" => 'ь', + "\xee" => 'Ь', + "\xef" => '№', + "\xf0" => '­', + "\xf1" => 'ы', + "\xf2" => 'Ы', + "\xf3" => 'з', + "\xf4" => 'З', + "\xf5" => 'ш', + "\xf6" => 'Ш', + "\xf7" => 'э', + "\xf8" => 'Э', + "\xf9" => 'щ', + "\xfa" => 'Щ', + "\xfb" => 'ч', + "\xfc" => 'Ч', + "\xfd" => '§', + "\xfe" => '■', + "\xff" => ' ' + ); + + $string = str_replace(array_keys($cp855), array_values($cp855), $string); + + return $string; +} + +?> \ No newline at end of file diff --git a/functions/decode/cp866.php b/functions/decode/cp866.php new file mode 100644 index 00000000..63e221bd --- /dev/null +++ b/functions/decode/cp866.php @@ -0,0 +1,171 @@ + + K.D. Chang + The entries are in cp866_DOSCyrillicRussian order +*/ + + +function charset_decode_cp866 ($string) { + global $default_charset; + + if (strtolower($default_charset) == 'ibm866') + return $string; + + /* Only do the slow convert if there are 8-bit characters */ + /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ + if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) ) + return $string; + + $cp866 = array( + "\x80" => 'А', + "\x81" => 'Б', + "\x82" => 'В', + "\x83" => 'Г', + "\x84" => 'Д', + "\x85" => 'Е', + "\x86" => 'Ж', + "\x87" => 'З', + "\x88" => 'И', + "\x89" => 'Й', + "\x8a" => 'К', + "\x8b" => 'Л', + "\x8c" => 'М', + "\x8d" => 'Н', + "\x8e" => 'О', + "\x8f" => 'П', + "\x90" => 'Р', + "\x91" => 'С', + "\x92" => 'Т', + "\x93" => 'У', + "\x94" => 'Ф', + "\x95" => 'Х', + "\x96" => 'Ц', + "\x97" => 'Ч', + "\x98" => 'Ш', + "\x99" => 'Щ', + "\x9a" => 'Ъ', + "\x9b" => 'Ы', + "\x9c" => 'Ь', + "\x9d" => 'Э', + "\x9e" => 'Ю', + "\x9f" => 'Я', + "\xa0" => 'а', + "\xa1" => 'б', + "\xa2" => 'в', + "\xa3" => 'г', + "\xa4" => 'д', + "\xa5" => 'е', + "\xa6" => 'ж', + "\xa7" => 'з', + "\xa8" => 'и', + "\xa9" => 'й', + "\xaa" => 'к', + "\xab" => 'л', + "\xac" => 'м', + "\xad" => 'н', + "\xae" => 'о', + "\xaf" => 'п', + "\xb0" => '░', + "\xb1" => '▒', + "\xb2" => '▓', + "\xb3" => '│', + "\xb4" => '┤', + "\xb5" => '╡', + "\xb6" => '╢', + "\xb7" => '╖', + "\xb8" => '╕', + "\xb9" => '╣', + "\xba" => '║', + "\xbb" => '╗', + "\xbc" => '╝', + "\xbd" => '╜', + "\xbe" => '╛', + "\xbf" => '┐', + "\xc0" => '└', + "\xc1" => '┴', + "\xc2" => '┬', + "\xc3" => '├', + "\xc4" => '─', + "\xc5" => '┼', + "\xc6" => '╞', + "\xc7" => '╟', + "\xc8" => '╚', + "\xc9" => '╔', + "\xca" => '╩', + "\xcb" => '╦', + "\xcc" => '╠', + "\xcd" => '═', + "\xce" => '╬', + "\xcf" => '╧', + "\xd0" => '╨', + "\xd1" => '╤', + "\xd2" => '╥', + "\xd3" => '╙', + "\xd4" => '╘', + "\xd5" => '╒', + "\xd6" => '╓', + "\xd7" => '╫', + "\xd8" => '╪', + "\xd9" => '┘', + "\xda" => '┌', + "\xdb" => '█', + "\xdc" => '▄', + "\xdd" => '▌', + "\xde" => '▐', + "\xdf" => '▀', + "\xe0" => 'р', + "\xe1" => 'с', + "\xe2" => 'т', + "\xe3" => 'у', + "\xe4" => 'ф', + "\xe5" => 'х', + "\xe6" => 'ц', + "\xe7" => 'ч', + "\xe8" => 'ш', + "\xe9" => 'щ', + "\xea" => 'ъ', + "\xeb" => 'ы', + "\xec" => 'ь', + "\xed" => 'э', + "\xee" => 'ю', + "\xef" => 'я', + "\xf0" => 'Ё', + "\xf1" => 'ё', + "\xf2" => 'Є', + "\xf3" => 'є', + "\xf4" => 'Ї', + "\xf5" => 'ї', + "\xf6" => 'Ў', + "\xf7" => 'ў', + "\xf8" => '°', + "\xf9" => '∙', + "\xfa" => '·', + "\xfb" => '√', + "\xfc" => '№', + "\xfd" => '¤', + "\xfe" => '■', + "\xff" => ' ' + ); + + $string = str_replace(array_keys($cp866), array_values($cp866), $string); + + return $string; +} diff --git a/functions/i18n.php b/functions/i18n.php index 10b7b04e..54a8c4e8 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -160,6 +160,33 @@ function charset_decode ($charset, $string) { } else if ($charset == 'windows-1258') { include_once(SM_PATH . 'functions/decode/cp1258.php'); $ret = charset_decode_cp1258 ($string); + } else if ($charset == 'x-mac-roman') { + include_once(SM_PATH . 'functions/decode/cp10000.php'); + $ret = charset_decode_cp10000 ($string); + } else if ($charset == 'x-mac-greek') { + include_once(SM_PATH . 'functions/decode/cp10006.php'); + $ret = charset_decode_cp10006 ($string); + } else if ($charset == 'x-mac-cyrillic') { + include_once(SM_PATH . 'functions/decode/cp10007.php'); + $ret = charset_decode_cp10007 ($string); + } else if ($charset == 'x-mac-ukrainian') { + include_once(SM_PATH . 'functions/decode/cp10017.php'); + $ret = charset_decode_cp10017 ($string); + } else if ($charset == 'x-mac-centraleurroman') { + include_once(SM_PATH . 'functions/decode/cp10029.php'); + $ret = charset_decode_cp10029 ($string); + } else if ($charset == 'x-mac-icelandic') { + include_once(SM_PATH . 'functions/decode/cp10079.php'); + $ret = charset_decode_cp10079 ($string); + } else if ($charset == 'x-mac-turkish') { + include_once(SM_PATH . 'functions/decode/cp10081.php'); + $ret = charset_decode_cp10081 ($string); + } else if ($charset == 'ibm855') { + include_once(SM_PATH . 'functions/decode/cp855.php'); + $ret = charset_decode_cp855 ($string); + } else if ($charset == 'ibm866') { + include_once(SM_PATH . 'functions/decode/cp866.php'); + $ret = charset_decode_cp866 ($string); } else if ($charset == 'tis-620') { include_once(SM_PATH . 'functions/decode/tis620.php'); $ret = charset_decode_tis620 ($string);