$ret = charset_decode_windows_1253 ($string);
} else if ($charset == 'windows-1254') {
$ret = charset_decode_windows_1254 ($string);
+ } else if ($charset == 'windows-1255') {
+ $ret = charset_decode_windows_1255 ($string);
+ } else if ($charset == 'windows-1256') {
+ $ret = charset_decode_windows_1256 ($string);
} else if ($charset == 'windows-1257') {
$ret = charset_decode_windows_1257 ($string);
} else if ($charset == 'utf-8') {
return (charset_decode_iso_8859_1($string));
}
+/*
+ windows-1255 (Hebr)
+ */
+function charset_decode_windows_1255 ($string) {
+ global $default_charset;
+
+ if (strtolower($default_charset) == 'windows-1255')
+ return $string;
+
+ /* Only do the slow convert if there are 8-bit characters */
+ if (! ereg("[\200-\377]", $string))
+ return $string;
+
+ $string = str_replace("\200", '€', $string);
+ $string = str_replace("\202", '‚', $string);
+ $string = str_replace("\203", 'ƒ', $string);
+ $string = str_replace("\204", '„', $string);
+ $string = str_replace("\205", '…', $string);
+ $string = str_replace("\206", '†', $string);
+ $string = str_replace("\207", '‡', $string);
+ $string = str_replace("\211", '‰', $string);
+ $string = str_replace("\213", '‹', $string);
+ $string = str_replace("\221", '‘', $string);
+ $string = str_replace("\222", '’', $string);
+ $string = str_replace("\223", '“', $string);
+ $string = str_replace("\224", '”', $string);
+ $string = str_replace("\225", '•', $string);
+ $string = str_replace("\226", '–', $string);
+ $string = str_replace("\227", '—', $string);
+ $string = str_replace("\231", '™', $string);
+ $string = str_replace("\233", '›', $string);
+ $string = str_replace("\240", ' ', $string);
+ // 162-169
+ $string = preg_replace("/([\242-\251])/e","'&#' . ord('\\1') . ';'",$string);
+ $string = str_replace("\252", '×', $string);
+ // 171-174
+ $string = preg_replace("/([\253-\256])/e","'&#' . ord('\\1') . ';'",$string);
+ $string = str_replace ("\257", '̍', $string);
+ // 176-185
+ $string = preg_replace("/([\260-\271])/e","'&#' . ord('\\1') . ';'",$string);
+ $string = str_replace ("\272", '÷', $string);
+ // 187-190
+ $string = preg_replace("/([\273-\276])/e","'&#' . ord('\\1') . ';'",$string);
+ $string = str_replace ("\337", '‗', $string);
+ // 224-250 1488-1514 (+1264)
+ $string = preg_replace("/([\340-\372])/e","'&#' . (ord('\\1')+1264) . ';'",$string);
+
+ return ($string);
+}
+
+/*
+ windows-1256 (Arab)
+ */
+function charset_decode_windows_1256 ($string) {
+ global $default_charset;
+
+ if (strtolower($default_charset) == 'windows-1256')
+ return $string;
+
+ /* Only do the slow convert if there are 8-bit characters */
+ if (! ereg("[\200-\377]", $string))
+ return $string;
+
+ $string = str_replace("\200", '،', $string);
+ $string = str_replace("\202", '‚', $string);
+ $string = str_replace("\204", '„', $string);
+ $string = str_replace("\205", '…', $string);
+ $string = str_replace("\206", '†', $string);
+ $string = str_replace("\207", '‡', $string);
+ $string = str_replace("\211", '‰', $string);
+ $string = str_replace("\213", '‹', $string);
+ $string = str_replace("\221", '‘', $string);
+ $string = str_replace("\222", '’', $string);
+ $string = str_replace("\223", '“', $string);
+ $string = str_replace("\224", '”', $string);
+ $string = str_replace("\225", '•', $string);
+ $string = str_replace("\226", '–', $string);
+ $string = str_replace("\227", '—', $string);
+ $string = str_replace("\230", '؜', $string);
+ $string = str_replace("\231", '™', $string);
+ $string = str_replace("\232", '؟', $string);
+ $string = str_replace("\233", '›', $string);
+ $string = str_replace("\234", 'ء', $string);
+ $string = str_replace("\235", 'آ', $string);
+ $string = str_replace("\236", 'أ', $string);
+ $string = str_replace("\237", 'Ÿ', $string);
+ $string = str_replace("\241", 'ؤ', $string);
+ $string = str_replace("\242", 'إ', $string);
+ $string = str_replace("\245", 'ئ', $string);
+ $string = str_replace ("\250", 'ا', $string);
+ $string = str_replace ("\252", 'ب', $string);
+ $string = str_replace ("\262", 'ة', $string);
+ $string = str_replace ("\263", 'ت', $string);
+ $string = str_replace ("\264", 'ث', $string);
+ $string = str_replace ("\270", 'ج', $string);
+ $string = str_replace ("\272", 'ح', $string);
+ $string = str_replace ("\274", 'خ', $string);
+ $string = str_replace ("\275", 'د', $string);
+ $string = str_replace ("\276", 'ذ', $string);
+ $string = str_replace ("\277", 'ر', $string);
+ $string = str_replace ("\301", 'ز', $string);
+ $string = str_replace ("\304", 'س', $string);
+ $string = str_replace ("\305", 'ش', $string);
+ $string = str_replace ("\306", 'ص', $string);
+ $string = str_replace ("\314", 'ض', $string);
+ $string = str_replace ("\315", 'ط', $string);
+ $string = str_replace ("\320", 'ظ', $string);
+ $string = str_replace ("\321", 'ع', $string);
+ $string = str_replace ("\322", 'غ', $string);
+ $string = str_replace ("\323", 'ـ', $string);
+ $string = str_replace ("\325", 'ف', $string);
+ $string = str_replace ("\326", 'ق', $string);
+ $string = str_replace ("\330", 'ك', $string);
+ $string = str_replace ("\332", 'گ', $string);
+ $string = str_replace ("\335", 'ل', $string);
+ $string = str_replace ("\336", 'م', $string);
+ $string = str_replace ("\337", 'ن', $string);
+ $string = str_replace ("\341", 'ه', $string);
+ $string = str_replace ("\344", 'و', $string);
+ $string = str_replace ("\345", 'ى', $string);
+ $string = str_replace ("\346", 'ي', $string);
+ $string = str_replace ("\354", 'ً', $string);
+ $string = str_replace ("\355", 'ٌ', $string);
+ $string = str_replace ("\360", 'ٍ', $string);
+ $string = str_replace ("\361", 'َ', $string);
+ $string = str_replace ("\362", 'ُ', $string);
+ $string = str_replace ("\363", 'ِ', $string);
+ $string = str_replace ("\365", 'ّ', $string);
+ $string = str_replace ("\366", 'ْ', $string);
+
+ // Rest of charset is like iso-8859-1
+ return (charset_decode_iso_8859_1($string));
+}
+
/*
windows-1257 (BaltRim)
*/