Explorar o código

More decoding functions

tokul %!s(int64=22) %!d(string=hai) anos
pai
achega
dd8a4c68d5

+ 171 - 0
functions/decode/cp1250.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1250.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+	"\x81" => '&#65533;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#65533;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#65533;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#352;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#346;',
+	"\x8D" => '&#356;',
+	"\x8E" => '&#381;',
+	"\x8F" => '&#377;',
+	"\x90" => '&#65533;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#65533;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#353;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#347;',
+	"\x9D" => '&#357;',
+	"\x9E" => '&#382;',
+	"\x9F" => '&#378;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#711;',
+	"\xA2" => '&#728;',
+	"\xA3" => '&#321;',
+	"\xA4" => '&#164;',
+	"\xA5" => '&#260;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#168;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#350;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#379;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#731;',
+	"\xB3" => '&#322;',
+	"\xB4" => '&#180;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#184;',
+	"\xB9" => '&#261;',
+	"\xBA" => '&#351;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#317;',
+	"\xBD" => '&#733;',
+	"\xBE" => '&#318;',
+	"\xBF" => '&#380;',
+	"\xC0" => '&#340;',
+	"\xC1" => '&#193;',
+	"\xC2" => '&#194;',
+	"\xC3" => '&#258;',
+	"\xC4" => '&#196;',
+	"\xC5" => '&#313;',
+	"\xC6" => '&#262;',
+	"\xC7" => '&#199;',
+	"\xC8" => '&#268;',
+	"\xC9" => '&#201;',
+	"\xCA" => '&#280;',
+	"\xCB" => '&#203;',
+	"\xCC" => '&#282;',
+	"\xCD" => '&#205;',
+	"\xCE" => '&#206;',
+	"\xCF" => '&#270;',
+	"\xD0" => '&#272;',
+	"\xD1" => '&#323;',
+	"\xD2" => '&#327;',
+	"\xD3" => '&#211;',
+	"\xD4" => '&#212;',
+	"\xD5" => '&#336;',
+	"\xD6" => '&#214;',
+	"\xD7" => '&#215;',
+	"\xD8" => '&#344;',
+	"\xD9" => '&#366;',
+	"\xDA" => '&#218;',
+	"\xDB" => '&#368;',
+	"\xDC" => '&#220;',
+	"\xDD" => '&#221;',
+	"\xDE" => '&#354;',
+	"\xDF" => '&#223;',
+	"\xE0" => '&#341;',
+	"\xE1" => '&#225;',
+	"\xE2" => '&#226;',
+	"\xE3" => '&#259;',
+	"\xE4" => '&#228;',
+	"\xE5" => '&#314;',
+	"\xE6" => '&#263;',
+	"\xE7" => '&#231;',
+	"\xE8" => '&#269;',
+	"\xE9" => '&#233;',
+	"\xEA" => '&#281;',
+	"\xEB" => '&#235;',
+	"\xEC" => '&#283;',
+	"\xED" => '&#237;',
+	"\xEE" => '&#238;',
+	"\xEF" => '&#271;',
+	"\xF0" => '&#273;',
+	"\xF1" => '&#324;',
+	"\xF2" => '&#328;',
+	"\xF3" => '&#243;',
+	"\xF4" => '&#244;',
+	"\xF5" => '&#337;',
+	"\xF6" => '&#246;',
+	"\xF7" => '&#247;',
+	"\xF8" => '&#345;',
+	"\xF9" => '&#367;',
+	"\xFA" => '&#250;',
+	"\xFB" => '&#369;',
+	"\xFC" => '&#252;',
+	"\xFD" => '&#253;',
+	"\xFE" => '&#355;',
+	"\xFF" => '&#729;'
+    );
+
+    $string = str_replace(array_keys($cp1250), array_values($cp1250), $string);
+
+    return $string;
+}
+
+?>

+ 171 - 0
functions/decode/cp1251.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1251.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#1026;',
+	"\x81" => '&#1027;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#1107;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#8364;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#1033;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#1034;',
+	"\x8D" => '&#1036;',
+	"\x8E" => '&#1035;',
+	"\x8F" => '&#1039;',
+	"\x90" => '&#1106;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#65533;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#1113;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#1114;',
+	"\x9D" => '&#1116;',
+	"\x9E" => '&#1115;',
+	"\x9F" => '&#1119;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#1038;',
+	"\xA2" => '&#1118;',
+	"\xA3" => '&#1032;',
+	"\xA4" => '&#164;',
+	"\xA5" => '&#1168;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#1025;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#1028;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#1031;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#1030;',
+	"\xB3" => '&#1110;',
+	"\xB4" => '&#1169;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#1105;',
+	"\xB9" => '&#8470;',
+	"\xBA" => '&#1108;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#1112;',
+	"\xBD" => '&#1029;',
+	"\xBE" => '&#1109;',
+	"\xBF" => '&#1111;',
+	"\xC0" => '&#1040;',
+	"\xC1" => '&#1041;',
+	"\xC2" => '&#1042;',
+	"\xC3" => '&#1043;',
+	"\xC4" => '&#1044;',
+	"\xC5" => '&#1045;',
+	"\xC6" => '&#1046;',
+	"\xC7" => '&#1047;',
+	"\xC8" => '&#1048;',
+	"\xC9" => '&#1049;',
+	"\xCA" => '&#1050;',
+	"\xCB" => '&#1051;',
+	"\xCC" => '&#1052;',
+	"\xCD" => '&#1053;',
+	"\xCE" => '&#1054;',
+	"\xCF" => '&#1055;',
+	"\xD0" => '&#1056;',
+	"\xD1" => '&#1057;',
+	"\xD2" => '&#1058;',
+	"\xD3" => '&#1059;',
+	"\xD4" => '&#1060;',
+	"\xD5" => '&#1061;',
+	"\xD6" => '&#1062;',
+	"\xD7" => '&#1063;',
+	"\xD8" => '&#1064;',
+	"\xD9" => '&#1065;',
+	"\xDA" => '&#1066;',
+	"\xDB" => '&#1067;',
+	"\xDC" => '&#1068;',
+	"\xDD" => '&#1069;',
+	"\xDE" => '&#1070;',
+	"\xDF" => '&#1071;',
+	"\xE0" => '&#1072;',
+	"\xE1" => '&#1073;',
+	"\xE2" => '&#1074;',
+	"\xE3" => '&#1075;',
+	"\xE4" => '&#1076;',
+	"\xE5" => '&#1077;',
+	"\xE6" => '&#1078;',
+	"\xE7" => '&#1079;',
+	"\xE8" => '&#1080;',
+	"\xE9" => '&#1081;',
+	"\xEA" => '&#1082;',
+	"\xEB" => '&#1083;',
+	"\xEC" => '&#1084;',
+	"\xED" => '&#1085;',
+	"\xEE" => '&#1086;',
+	"\xEF" => '&#1087;',
+	"\xF0" => '&#1088;',
+	"\xF1" => '&#1089;',
+	"\xF2" => '&#1090;',
+	"\xF3" => '&#1091;',
+	"\xF4" => '&#1092;',
+	"\xF5" => '&#1093;',
+	"\xF6" => '&#1094;',
+	"\xF7" => '&#1095;',
+	"\xF8" => '&#1096;',
+	"\xF9" => '&#1097;',
+	"\xFA" => '&#1098;',
+	"\xFB" => '&#1099;',
+	"\xFC" => '&#1100;',
+	"\xFD" => '&#1101;',
+	"\xFE" => '&#1102;',
+	"\xFF" => '&#1103;'
+    );
+
+    $string = str_replace(array_keys($cp1251), array_values($cp1251), $string);
+
+    return $string;
+}
+
+?>

+ 171 - 0
functions/decode/cp1252.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1252.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+	"\x81" => '&#65533;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#402;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#710;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#352;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#338;',
+	"\x8D" => '&#65533;',
+	"\x8E" => '&#381;',
+	"\x8F" => '&#65533;',
+	"\x90" => '&#65533;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#732;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#353;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#339;',
+	"\x9D" => '&#65533;',
+	"\x9E" => '&#382;',
+	"\x9F" => '&#376;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#161;',
+	"\xA2" => '&#162;',
+	"\xA3" => '&#163;',
+	"\xA4" => '&#164;',
+	"\xA5" => '&#165;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#168;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#170;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#175;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#178;',
+	"\xB3" => '&#179;',
+	"\xB4" => '&#180;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#184;',
+	"\xB9" => '&#185;',
+	"\xBA" => '&#186;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#188;',
+	"\xBD" => '&#189;',
+	"\xBE" => '&#190;',
+	"\xBF" => '&#191;',
+	"\xC0" => '&#192;',
+	"\xC1" => '&#193;',
+	"\xC2" => '&#194;',
+	"\xC3" => '&#195;',
+	"\xC4" => '&#196;',
+	"\xC5" => '&#197;',
+	"\xC6" => '&#198;',
+	"\xC7" => '&#199;',
+	"\xC8" => '&#200;',
+	"\xC9" => '&#201;',
+	"\xCA" => '&#202;',
+	"\xCB" => '&#203;',
+	"\xCC" => '&#204;',
+	"\xCD" => '&#205;',
+	"\xCE" => '&#206;',
+	"\xCF" => '&#207;',
+	"\xD0" => '&#208;',
+	"\xD1" => '&#209;',
+	"\xD2" => '&#210;',
+	"\xD3" => '&#211;',
+	"\xD4" => '&#212;',
+	"\xD5" => '&#213;',
+	"\xD6" => '&#214;',
+	"\xD7" => '&#215;',
+	"\xD8" => '&#216;',
+	"\xD9" => '&#217;',
+	"\xDA" => '&#218;',
+	"\xDB" => '&#219;',
+	"\xDC" => '&#220;',
+	"\xDD" => '&#221;',
+	"\xDE" => '&#222;',
+	"\xDF" => '&#223;',
+	"\xE0" => '&#224;',
+	"\xE1" => '&#225;',
+	"\xE2" => '&#226;',
+	"\xE3" => '&#227;',
+	"\xE4" => '&#228;',
+	"\xE5" => '&#229;',
+	"\xE6" => '&#230;',
+	"\xE7" => '&#231;',
+	"\xE8" => '&#232;',
+	"\xE9" => '&#233;',
+	"\xEA" => '&#234;',
+	"\xEB" => '&#235;',
+	"\xEC" => '&#236;',
+	"\xED" => '&#237;',
+	"\xEE" => '&#238;',
+	"\xEF" => '&#239;',
+	"\xF0" => '&#240;',
+	"\xF1" => '&#241;',
+	"\xF2" => '&#242;',
+	"\xF3" => '&#243;',
+	"\xF4" => '&#244;',
+	"\xF5" => '&#245;',
+	"\xF6" => '&#246;',
+	"\xF7" => '&#247;',
+	"\xF8" => '&#248;',
+	"\xF9" => '&#249;',
+	"\xFA" => '&#250;',
+	"\xFB" => '&#251;',
+	"\xFC" => '&#252;',
+	"\xFD" => '&#253;',
+	"\xFE" => '&#254;',
+	"\xFF" => '&#255;'
+    );
+
+    $string = str_replace(array_keys($cp1252), array_values($cp1252), $string);
+
+    return $string;
+}
+
+?>

+ 171 - 0
functions/decode/cp1253.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1253.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+	"\x81" => '&#65533;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#402;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#65533;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#65533;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#65533;',
+	"\x8D" => '&#65533;',
+	"\x8E" => '&#65533;',
+	"\x8F" => '&#65533;',
+	"\x90" => '&#65533;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#65533;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#65533;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#65533;',
+	"\x9D" => '&#65533;',
+	"\x9E" => '&#65533;',
+	"\x9F" => '&#65533;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#901;',
+	"\xA2" => '&#902;',
+	"\xA3" => '&#163;',
+	"\xA4" => '&#164;',
+	"\xA5" => '&#165;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#168;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#65533;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#8213;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#178;',
+	"\xB3" => '&#179;',
+	"\xB4" => '&#900;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#904;',
+	"\xB9" => '&#905;',
+	"\xBA" => '&#906;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#908;',
+	"\xBD" => '&#189;',
+	"\xBE" => '&#910;',
+	"\xBF" => '&#911;',
+	"\xC0" => '&#912;',
+	"\xC1" => '&#913;',
+	"\xC2" => '&#914;',
+	"\xC3" => '&#915;',
+	"\xC4" => '&#916;',
+	"\xC5" => '&#917;',
+	"\xC6" => '&#918;',
+	"\xC7" => '&#919;',
+	"\xC8" => '&#920;',
+	"\xC9" => '&#921;',
+	"\xCA" => '&#922;',
+	"\xCB" => '&#923;',
+	"\xCC" => '&#924;',
+	"\xCD" => '&#925;',
+	"\xCE" => '&#926;',
+	"\xCF" => '&#927;',
+	"\xD0" => '&#928;',
+	"\xD1" => '&#929;',
+	"\xD2" => '&#65533;',
+	"\xD3" => '&#931;',
+	"\xD4" => '&#932;',
+	"\xD5" => '&#933;',
+	"\xD6" => '&#934;',
+	"\xD7" => '&#935;',
+	"\xD8" => '&#936;',
+	"\xD9" => '&#937;',
+	"\xDA" => '&#938;',
+	"\xDB" => '&#939;',
+	"\xDC" => '&#940;',
+	"\xDD" => '&#941;',
+	"\xDE" => '&#942;',
+	"\xDF" => '&#943;',
+	"\xE0" => '&#944;',
+	"\xE1" => '&#945;',
+	"\xE2" => '&#946;',
+	"\xE3" => '&#947;',
+	"\xE4" => '&#948;',
+	"\xE5" => '&#949;',
+	"\xE6" => '&#950;',
+	"\xE7" => '&#951;',
+	"\xE8" => '&#952;',
+	"\xE9" => '&#953;',
+	"\xEA" => '&#954;',
+	"\xEB" => '&#955;',
+	"\xEC" => '&#956;',
+	"\xED" => '&#957;',
+	"\xEE" => '&#958;',
+	"\xEF" => '&#959;',
+	"\xF0" => '&#960;',
+	"\xF1" => '&#961;',
+	"\xF2" => '&#962;',
+	"\xF3" => '&#963;',
+	"\xF4" => '&#964;',
+	"\xF5" => '&#965;',
+	"\xF6" => '&#966;',
+	"\xF7" => '&#967;',
+	"\xF8" => '&#968;',
+	"\xF9" => '&#969;',
+	"\xFA" => '&#970;',
+	"\xFB" => '&#971;',
+	"\xFC" => '&#972;',
+	"\xFD" => '&#973;',
+	"\xFE" => '&#974;',
+	"\xFF" => '&#65533;'
+    );
+
+    $string = str_replace(array_keys($cp1253), array_values($cp1253), $string);
+
+    return $string;
+}
+
+?>

+ 171 - 0
functions/decode/cp1254.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1254.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+	"\x81" => '&#65533;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#402;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#710;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#352;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#338;',
+	"\x8D" => '&#65533;',
+	"\x8E" => '&#65533;',
+	"\x8F" => '&#65533;',
+	"\x90" => '&#65533;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#732;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#353;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#339;',
+	"\x9D" => '&#65533;',
+	"\x9E" => '&#65533;',
+	"\x9F" => '&#376;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#161;',
+	"\xA2" => '&#162;',
+	"\xA3" => '&#163;',
+	"\xA4" => '&#164;',
+	"\xA5" => '&#165;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#168;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#170;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#175;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#178;',
+	"\xB3" => '&#179;',
+	"\xB4" => '&#180;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#184;',
+	"\xB9" => '&#185;',
+	"\xBA" => '&#186;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#188;',
+	"\xBD" => '&#189;',
+	"\xBE" => '&#190;',
+	"\xBF" => '&#191;',
+	"\xC0" => '&#192;',
+	"\xC1" => '&#193;',
+	"\xC2" => '&#194;',
+	"\xC3" => '&#195;',
+	"\xC4" => '&#196;',
+	"\xC5" => '&#197;',
+	"\xC6" => '&#198;',
+	"\xC7" => '&#199;',
+	"\xC8" => '&#200;',
+	"\xC9" => '&#201;',
+	"\xCA" => '&#202;',
+	"\xCB" => '&#203;',
+	"\xCC" => '&#204;',
+	"\xCD" => '&#205;',
+	"\xCE" => '&#206;',
+	"\xCF" => '&#207;',
+	"\xD0" => '&#286;',
+	"\xD1" => '&#209;',
+	"\xD2" => '&#210;',
+	"\xD3" => '&#211;',
+	"\xD4" => '&#212;',
+	"\xD5" => '&#213;',
+	"\xD6" => '&#214;',
+	"\xD7" => '&#215;',
+	"\xD8" => '&#216;',
+	"\xD9" => '&#217;',
+	"\xDA" => '&#218;',
+	"\xDB" => '&#219;',
+	"\xDC" => '&#220;',
+	"\xDD" => '&#304;',
+	"\xDE" => '&#350;',
+	"\xDF" => '&#223;',
+	"\xE0" => '&#224;',
+	"\xE1" => '&#225;',
+	"\xE2" => '&#226;',
+	"\xE3" => '&#227;',
+	"\xE4" => '&#228;',
+	"\xE5" => '&#229;',
+	"\xE6" => '&#230;',
+	"\xE7" => '&#231;',
+	"\xE8" => '&#232;',
+	"\xE9" => '&#233;',
+	"\xEA" => '&#234;',
+	"\xEB" => '&#235;',
+	"\xEC" => '&#236;',
+	"\xED" => '&#237;',
+	"\xEE" => '&#238;',
+	"\xEF" => '&#239;',
+	"\xF0" => '&#287;',
+	"\xF1" => '&#241;',
+	"\xF2" => '&#242;',
+	"\xF3" => '&#243;',
+	"\xF4" => '&#244;',
+	"\xF5" => '&#245;',
+	"\xF6" => '&#246;',
+	"\xF7" => '&#247;',
+	"\xF8" => '&#248;',
+	"\xF9" => '&#249;',
+	"\xFA" => '&#250;',
+	"\xFB" => '&#251;',
+	"\xFC" => '&#252;',
+	"\xFD" => '&#305;',
+	"\xFE" => '&#351;',
+	"\xFF" => '&#255;'
+    );
+
+    $string = str_replace(array_keys($cp1254), array_values($cp1254), $string);
+
+    return $string;
+}
+
+?>

+ 171 - 0
functions/decode/cp1255.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1255.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+	"\x81" => '&#65533;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#402;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#710;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#65533;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#65533;',
+	"\x8D" => '&#65533;',
+	"\x8E" => '&#65533;',
+	"\x8F" => '&#65533;',
+	"\x90" => '&#65533;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#732;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#65533;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#65533;',
+	"\x9D" => '&#65533;',
+	"\x9E" => '&#65533;',
+	"\x9F" => '&#65533;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#161;',
+	"\xA2" => '&#162;',
+	"\xA3" => '&#163;',
+	"\xA4" => '&#8362;',
+	"\xA5" => '&#165;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#168;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#215;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#175;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#178;',
+	"\xB3" => '&#179;',
+	"\xB4" => '&#180;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#184;',
+	"\xB9" => '&#185;',
+	"\xBA" => '&#247;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#188;',
+	"\xBD" => '&#189;',
+	"\xBE" => '&#190;',
+	"\xBF" => '&#191;',
+	"\xC0" => '&#1456;',
+	"\xC1" => '&#1457;',
+	"\xC2" => '&#1458;',
+	"\xC3" => '&#1459;',
+	"\xC4" => '&#1460;',
+	"\xC5" => '&#1461;',
+	"\xC6" => '&#1462;',
+	"\xC7" => '&#1463;',
+	"\xC8" => '&#1464;',
+	"\xC9" => '&#1465;',
+	"\xCA" => '&#65533;',
+	"\xCB" => '&#1467;',
+	"\xCC" => '&#1468;',
+	"\xCD" => '&#1469;',
+	"\xCE" => '&#1470;',
+	"\xCF" => '&#1471;',
+	"\xD0" => '&#1472;',
+	"\xD1" => '&#1473;',
+	"\xD2" => '&#1474;',
+	"\xD3" => '&#1475;',
+	"\xD4" => '&#1520;',
+	"\xD5" => '&#1521;',
+	"\xD6" => '&#1522;',
+	"\xD7" => '&#1523;',
+	"\xD8" => '&#1524;',
+	"\xD9" => '&#65533;',
+	"\xDA" => '&#65533;',
+	"\xDB" => '&#65533;',
+	"\xDC" => '&#65533;',
+	"\xDD" => '&#65533;',
+	"\xDE" => '&#65533;',
+	"\xDF" => '&#65533;',
+	"\xE0" => '&#1488;',
+	"\xE1" => '&#1489;',
+	"\xE2" => '&#1490;',
+	"\xE3" => '&#1491;',
+	"\xE4" => '&#1492;',
+	"\xE5" => '&#1493;',
+	"\xE6" => '&#1494;',
+	"\xE7" => '&#1495;',
+	"\xE8" => '&#1496;',
+	"\xE9" => '&#1497;',
+	"\xEA" => '&#1498;',
+	"\xEB" => '&#1499;',
+	"\xEC" => '&#1500;',
+	"\xED" => '&#1501;',
+	"\xEE" => '&#1502;',
+	"\xEF" => '&#1503;',
+	"\xF0" => '&#1504;',
+	"\xF1" => '&#1505;',
+	"\xF2" => '&#1506;',
+	"\xF3" => '&#1507;',
+	"\xF4" => '&#1508;',
+	"\xF5" => '&#1509;',
+	"\xF6" => '&#1510;',
+	"\xF7" => '&#1511;',
+	"\xF8" => '&#1512;',
+	"\xF9" => '&#1513;',
+	"\xFA" => '&#1514;',
+	"\xFB" => '&#65533;',
+	"\xFC" => '&#65533;',
+	"\xFD" => '&#8206;',
+	"\xFE" => '&#8207;',
+	"\xFF" => '&#65533;'
+    );
+
+    $string = str_replace(array_keys($cp1255), array_values($cp1255), $string);
+
+    return $string;
+}
+
+?>

+ 164 - 0
functions/decode/cp1256.php

@@ -0,0 +1,164 @@
+<?php
+/*
+ * decode/cp1256.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+"\x81" => '&#1662;',
+"\x82" => '&#8218;',
+"\x83" => '&#402;',
+"\x84" => '&#8222;',
+"\x85" => '&#8230;',
+"\x86" => '&#8224;',
+"\x87" => '&#8225;',
+"\x88" => '&#710;',
+"\x89" => '&#8240;',
+"\x8A" => '&#1657;',
+"\x8B" => '&#8249;',
+"\x8C" => '&#338;',
+"\x8D" => '&#1670;',
+"\x8E" => '&#1688;',
+"\x8F" => '&#1672;',
+"\x90" => '&#1711;',
+"\x91" => '&#8216;',
+"\x92" => '&#8217;',
+"\x93" => '&#8220;',
+"\x94" => '&#8221;',
+"\x95" => '&#8226;',
+"\x96" => '&#8211;',
+"\x97" => '&#8212;',
+"\x98" => '&#1705;',
+"\x99" => '&#8482;',
+"\x9A" => '&#1681;',
+"\x9B" => '&#8250;',
+"\x9C" => '&#339;',
+"\x9D" => '&#8204;',
+"\x9E" => '&#8205;',
+"\x9F" => '&#1722;',
+"\xA0" => '&#160;',
+"\xA1" => '&#1548;',
+"\xA2" => '&#162;',
+"\xA3" => '&#163;',
+"\xA4" => '&#164;',
+"\xA5" => '&#165;',
+"\xA6" => '&#166;',
+"\xA7" => '&#167;',
+"\xA8" => '&#168;',
+"\xA9" => '&#169;',
+"\xAA" => '&#1726;',
+"\xAB" => '&#171;',
+"\xAC" => '&#172;',
+"\xAD" => '&#173;',
+"\xAE" => '&#174;',
+"\xAF" => '&#175;',
+"\xB0" => '&#176;',
+"\xB1" => '&#177;',
+"\xB2" => '&#178;',
+"\xB3" => '&#179;',
+"\xB4" => '&#180;',
+"\xB5" => '&#181;',
+"\xB6" => '&#182;',
+"\xB7" => '&#183;',
+"\xB8" => '&#184;',
+"\xB9" => '&#185;',
+"\xBA" => '&#1563;',
+"\xBB" => '&#187;',
+"\xBC" => '&#188;',
+"\xBD" => '&#189;',
+"\xBE" => '&#190;',
+"\xBF" => '&#1567;',
+"\xC0" => '&#1729;',
+"\xC1" => '&#1569;',
+"\xC2" => '&#1570;',
+"\xC3" => '&#1571;',
+"\xC4" => '&#1572;',
+"\xC5" => '&#1573;',
+"\xC6" => '&#1574;',
+"\xC7" => '&#1575;',
+"\xC8" => '&#1576;',
+"\xC9" => '&#1577;',
+"\xCA" => '&#1578;',
+"\xCB" => '&#1579;',
+"\xCC" => '&#1580;',
+"\xCD" => '&#1581;',
+"\xCE" => '&#1582;',
+"\xCF" => '&#1583;',
+"\xD0" => '&#1584;',
+"\xD1" => '&#1585;',
+"\xD2" => '&#1586;',
+"\xD3" => '&#1587;',
+"\xD4" => '&#1588;',
+"\xD5" => '&#1589;',
+"\xD6" => '&#1590;',
+"\xD7" => '&#215;',
+"\xD8" => '&#1591;',
+"\xD9" => '&#1592;',
+"\xDA" => '&#1593;',
+"\xDB" => '&#1594;',
+"\xDC" => '&#1600;',
+"\xDD" => '&#1601;',
+"\xDE" => '&#1602;',
+"\xDF" => '&#1603;',
+"\xE0" => '&#224;',
+"\xE1" => '&#1604;',
+"\xE2" => '&#226;',
+"\xE3" => '&#1605;',
+"\xE4" => '&#1606;',
+"\xE5" => '&#1607;',
+"\xE6" => '&#1608;',
+"\xE7" => '&#231;',
+"\xE8" => '&#232;',
+"\xE9" => '&#233;',
+"\xEA" => '&#234;',
+"\xEB" => '&#235;',
+"\xEC" => '&#1609;',
+"\xED" => '&#1610;',
+"\xEE" => '&#238;',
+"\xEF" => '&#239;',
+"\xF0" => '&#1611;',
+"\xF1" => '&#1612;',
+"\xF2" => '&#1613;',
+"\xF3" => '&#1614;',
+"\xF4" => '&#244;',
+"\xF5" => '&#1615;',
+"\xF6" => '&#1616;',
+"\xF7" => '&#247;',
+"\xF8" => '&#1617;',
+"\xF9" => '&#249;',
+"\xFA" => '&#1618;',
+"\xFB" => '&#251;',
+"\xFC" => '&#252;',
+"\xFD" => '&#8206;',
+"\xFE" => '&#8207;',
+"\xFF" => '&#1746;'

+ 171 - 0
functions/decode/cp1258.php

@@ -0,0 +1,171 @@
+<?php
+/*
+ * decode/cp1258.php
+ * $Id$
+ *
+ * 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:       cpxlate@microsoft.com
+ *
+ */
+
+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" => '&#8364;',
+	"\x81" => '&#65533;',
+	"\x82" => '&#8218;',
+	"\x83" => '&#402;',
+	"\x84" => '&#8222;',
+	"\x85" => '&#8230;',
+	"\x86" => '&#8224;',
+	"\x87" => '&#8225;',
+	"\x88" => '&#710;',
+	"\x89" => '&#8240;',
+	"\x8A" => '&#65533;',
+	"\x8B" => '&#8249;',
+	"\x8C" => '&#338;',
+	"\x8D" => '&#65533;',
+	"\x8E" => '&#65533;',
+	"\x8F" => '&#65533;',
+	"\x90" => '&#65533;',
+	"\x91" => '&#8216;',
+	"\x92" => '&#8217;',
+	"\x93" => '&#8220;',
+	"\x94" => '&#8221;',
+	"\x95" => '&#8226;',
+	"\x96" => '&#8211;',
+	"\x97" => '&#8212;',
+	"\x98" => '&#732;',
+	"\x99" => '&#8482;',
+	"\x9A" => '&#65533;',
+	"\x9B" => '&#8250;',
+	"\x9C" => '&#339;',
+	"\x9D" => '&#65533;',
+	"\x9E" => '&#65533;',
+	"\x9F" => '&#376;',
+	"\xA0" => '&#160;',
+	"\xA1" => '&#161;',
+	"\xA2" => '&#162;',
+	"\xA3" => '&#163;',
+	"\xA4" => '&#164;',
+	"\xA5" => '&#165;',
+	"\xA6" => '&#166;',
+	"\xA7" => '&#167;',
+	"\xA8" => '&#168;',
+	"\xA9" => '&#169;',
+	"\xAA" => '&#170;',
+	"\xAB" => '&#171;',
+	"\xAC" => '&#172;',
+	"\xAD" => '&#173;',
+	"\xAE" => '&#174;',
+	"\xAF" => '&#175;',
+	"\xB0" => '&#176;',
+	"\xB1" => '&#177;',
+	"\xB2" => '&#178;',
+	"\xB3" => '&#179;',
+	"\xB4" => '&#180;',
+	"\xB5" => '&#181;',
+	"\xB6" => '&#182;',
+	"\xB7" => '&#183;',
+	"\xB8" => '&#184;',
+	"\xB9" => '&#185;',
+	"\xBA" => '&#186;',
+	"\xBB" => '&#187;',
+	"\xBC" => '&#188;',
+	"\xBD" => '&#189;',
+	"\xBE" => '&#190;',
+	"\xBF" => '&#191;',
+	"\xC0" => '&#192;',
+	"\xC1" => '&#193;',
+	"\xC2" => '&#194;',
+	"\xC3" => '&#258;',
+	"\xC4" => '&#196;',
+	"\xC5" => '&#197;',
+	"\xC6" => '&#198;',
+	"\xC7" => '&#199;',
+	"\xC8" => '&#200;',
+	"\xC9" => '&#201;',
+	"\xCA" => '&#202;',
+	"\xCB" => '&#203;',
+	"\xCC" => '&#768;',
+	"\xCD" => '&#205;',
+	"\xCE" => '&#206;',
+	"\xCF" => '&#207;',
+	"\xD0" => '&#272;',
+	"\xD1" => '&#209;',
+	"\xD2" => '&#777;',
+	"\xD3" => '&#211;',
+	"\xD4" => '&#212;',
+	"\xD5" => '&#416;',
+	"\xD6" => '&#214;',
+	"\xD7" => '&#215;',
+	"\xD8" => '&#216;',
+	"\xD9" => '&#217;',
+	"\xDA" => '&#218;',
+	"\xDB" => '&#219;',
+	"\xDC" => '&#220;',
+	"\xDD" => '&#431;',
+	"\xDE" => '&#771;',
+	"\xDF" => '&#223;',
+	"\xE0" => '&#224;',
+	"\xE1" => '&#225;',
+	"\xE2" => '&#226;',
+	"\xE3" => '&#259;',
+	"\xE4" => '&#228;',
+	"\xE5" => '&#229;',
+	"\xE6" => '&#230;',
+	"\xE7" => '&#231;',
+	"\xE8" => '&#232;',
+	"\xE9" => '&#233;',
+	"\xEA" => '&#234;',
+	"\xEB" => '&#235;',
+	"\xEC" => '&#769;',
+	"\xED" => '&#237;',
+	"\xEE" => '&#238;',
+	"\xEF" => '&#239;',
+	"\xF0" => '&#273;',
+	"\xF1" => '&#241;',
+	"\xF2" => '&#803;',
+	"\xF3" => '&#243;',
+	"\xF4" => '&#244;',
+	"\xF5" => '&#417;',
+	"\xF6" => '&#246;',
+	"\xF7" => '&#247;',
+	"\xF8" => '&#248;',
+	"\xF9" => '&#249;',
+	"\xFA" => '&#250;',
+	"\xFB" => '&#251;',
+	"\xFC" => '&#252;',
+	"\xFD" => '&#432;',
+	"\xFE" => '&#8363;',
+	"\xFF" => '&#255;'
+    );
+
+    $string = str_replace(array_keys($cp1258), array_values($cp1258), $string);
+
+    return $string;
+}
+
+?>