From: Tomas K. <to...@us...> - 2003-06-22 14:05:14
|
Update of /cvsroot/squirrelmail/squirrelmail/functions/decode In directory sc8-pr-cvs1:/tmp/cvs-serv7505 Added Files: cp1250.php cp1251.php cp1252.php cp1253.php cp1254.php cp1255.php cp1256.php cp1258.php Log Message: More decoding functions --- NEW FILE --- <?php /* * decode/cp1250.php * $Id: cp1250.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1250 decoding function that is needed to read * cp1250 encoded mails in non-cp1250 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT * * Name: cp1250 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 04/15/98 * Contact: cp...@mi... * */ function charset_decode_cp1250 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1250') 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; $cp1250 = 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($cp1250), array_values($cp1250), $string); return $string; } ?> --- NEW FILE --- <?php /* * decode/cp1251.php * $Id: cp1251.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1251 decoding function that is needed to read * cp1251 encoded mails in non-cp1251 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT * * Name: cp1251 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 04/15/98 * Contact: cp...@mi... * */ function charset_decode_cp1251 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1251') 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; $cp1251 = 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($cp1251), array_values($cp1251), $string); return $string; } ?> --- NEW FILE --- <?php /* * decode/cp1252.php * $Id: cp1252.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1252 decoding function that is needed to read * cp1252 encoded mails in non-cp1252 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT * * Name: cp1252 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 04/15/98 * Contact: cp...@mi... * */ function charset_decode_cp1252 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1252') 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; $cp1252 = 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($cp1252), array_values($cp1252), $string); return $string; } ?> --- NEW FILE --- <?php /* * decode/cp1253.php * $Id: cp1253.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1253 decoding function that is needed to read * cp1253 encoded mails in non-cp1253 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT * * Name: cp1253 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 04/15/98 * Contact: cp...@mi... * */ function charset_decode_cp1253 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1253') 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; $cp1253 = 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($cp1253), array_values($cp1253), $string); return $string; } ?> --- NEW FILE --- <?php /* * decode/cp1254.php * $Id: cp1254.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1254 decoding function that is needed to read * cp1254 encoded mails in non-cp1254 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT * * Name: cp1254 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 04/15/98 * Contact: cp...@mi... * */ function charset_decode_cp1254 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1254') 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; $cp1254 = 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($cp1254), array_values($cp1254), $string); return $string; } ?> --- NEW FILE --- <?php /* * decode/cp1255.php * $Id: cp1255.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1255 decoding function that is needed to read * cp1255 encoded mails in non-cp1255 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT * * Name: cp1255 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 1/7/2000 * Contact: cp...@mi... * */ function charset_decode_cp1255 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1255') 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; $cp1255 = 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($cp1255), array_values($cp1255), $string); return $string; } ?> --- NEW FILE --- <?php /* * decode/cp1256.php * $Id: cp1256.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1256 decoding function that is needed to read * cp1256 encoded mails in non-cp1256 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT * * Name: cp1256 to Unicode table * Unicode version: 2.1 * Table version: 2.01 * Table format: Format A * Date: 01/5/99 * Contact: cp...@mi... * */ function charset_decode_cp1257 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1257') 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; $cp1257 = 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" => 'ے' --- NEW FILE --- <?php /* * decode/cp1258.php * $Id: cp1258.php,v 1.1 2003/06/22 14:05:12 tokul Exp $ * * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * This file contains cp1258 decoding function that is needed to read * cp1258 encoded mails in non-cp1258 locale. * * Original data taken from: * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT * * Name: cp1258 to Unicode table * Unicode version: 2.0 * Table version: 2.01 * Table format: Format A * Date: 04/15/98 * Contact: cp...@mi... * */ function charset_decode_cp1258 ($string) { global $default_charset; if (strtolower($default_charset) == 'windows-1258') 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; $cp1258 = 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($cp1258), array_values($cp1258), $string); return $string; } ?> |