Exemple #1
0
/**
 * Decode utf-8 strings
 * @param string $string Encoded string
 * @return string Decoded string
 */
function charset_decode_utf_8($string)
{
    global $squirrelmail_language;
    // Japanese translation uses mbstring function to read utf-8
    if ($squirrelmail_language == 'ja_JP') {
        return $string;
    }
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'utf-8')) {
        return $string;
    }
    // decode six byte unicode characters
    /* (i think currently there is no such symbol)
       $string = preg_replace("/([\374-\375])([\200-\277])([\200-\277])([\200-\277])([\200-\277])([\200-\277])/e",
       "'&#'.((ord('\\1')-252)*1073741824+(ord('\\2')-200)*16777216+(ord('\\3')-200)*262144+(ord('\\4')-128)*4096+(ord('\\5')-128)*64+(ord('\\6')-128)).';'",
       $string);
       */
    // decode five byte unicode characters
    /* (i think currently there is no such symbol)
       $string = preg_replace("/([\370-\373])([\200-\277])([\200-\277])([\200-\277])([\200-\277])/e",
       "'&#'.((ord('\\1')-248)*16777216+(ord('\\2')-200)*262144+(ord('\\3')-128)*4096+(ord('\\4')-128)*64+(ord('\\5')-128)).';'",
       $string);
       */
    // decode four byte unicode characters
    $string = preg_replace("/([ð-÷])([€-¿])([€-¿])([€-¿])/e", "'&#'.((ord('\\1')-240)*262144+(ord('\\2')-128)*4096+(ord('\\3')-128)*64+(ord('\\4')-128)).';'", $string);
    // decode three byte unicode characters
    $string = preg_replace("/([à-ï])([€-¿])([€-¿])/e", "'&#'.((ord('\\1')-224)*4096+(ord('\\2')-128)*64+(ord('\\3')-128)).';'", $string);
    // decode two byte unicode characters
    $string = preg_replace("/([À-ß])([€-¿])/e", "'&#'.((ord('\\1')-192)*64+(ord('\\2')-128)).';'", $string);
    // remove broken unicode
    $string = preg_replace("/[€-Ÿ]| |[¡-ÿ]/", '?', $string);
    return $string;
}
Exemple #2
0
/**
 * Decode gb18030 encoded string
 * @param string $string gb18030 string
 * @param boolean $save_html don't html encode special characters if true
 * @return string $string decoded string
 */
function charset_decode_gb18030($string, $save_html = false)
{
    // global $aggressive_decoding;
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'gb18030')) {
        return $string;
    }
    // this is CPU intensive task. Use recode functions if they are available.
    if (function_exists('recode_string')) {
        // if string is already sanitized, undo htmlspecial chars
        if (!$save_html) {
            $string = str_replace(array('&quot;', '&lt;', '&gt;', '&amp;'), array('"', '<', '>', '&'), $string);
        }
        $string = recode_string("gb18030..html", $string);
        // if string sanitizing is not needed, undo htmlspecialchars applied by recode.
        if ($save_html) {
            $string = str_replace(array('&quot;', '&lt;', '&gt;', '&amp;'), array('"', '<', '>', '&'), $string);
        }
        return $string;
    }
    /*
     * iconv does not support html target, but internal utf-8 decoding is faster 
     * than pure php implementation. 
     */
    if (function_exists('iconv') && file_exists(SM_PATH . 'functions/decode/utf_8.php')) {
        include_once SM_PATH . 'functions/decode/utf_8.php';
        $string = iconv('gb18030', 'utf-8', $string);
        return charset_decode_utf_8($string);
    }
    // mbstring does not support gb18030
    // pure php decoding is not implemented.
    return $string;
}
Exemple #3
0
/**
 * Decode euc-kr encoded string
 * @param string $string euc-kr string
 * @param boolean $save_html don't html encode special characters if true
 * @return string $string decoded string
 */
function charset_decode_euc_kr($string, $save_html = false)
{
    // global $aggressive_decoding;
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'euc-kr')) {
        return $string;
    }
    // this is CPU intensive task. Use recode functions if they are available.
    if (function_exists('recode_string')) {
        // if string is already sanitized, undo htmlspecial chars
        if (!$save_html) {
            $string = str_replace(array('&quot;', '&lt;', '&gt;', '&amp;'), array('"', '<', '>', '&'), $string);
        }
        $string = recode_string("euc-kr..html", $string);
        // if string sanitizing is not needed, undo htmlspecialchars applied by recode.
        if ($save_html) {
            $string = str_replace(array('&quot;', '&lt;', '&gt;', '&amp;'), array('"', '<', '>', '&'), $string);
        }
        return $string;
    }
    /*
     * iconv does not support html target, but internal utf-8 decoding is faster 
     * than pure php implementation. 
     */
    if (function_exists('iconv') && file_exists(SM_PATH . 'functions/decode/utf_8.php')) {
        include_once SM_PATH . 'functions/decode/utf_8.php';
        $string = iconv('euc-kr', 'utf-8', $string);
        return charset_decode_utf_8($string);
    }
    // try mbstring
    if (function_exists('mb_convert_encoding') && function_exists('sq_mb_list_encodings') && check_php_version(4, 3, 0) && in_array('euc-kr', sq_mb_list_encodings())) {
        return mb_convert_encoding($string, 'HTML-ENTITIES', 'EUC-KR');
    }
    return $string;
}
Exemple #4
0
/**
 * Decode iso8859-7 encoded strings
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_7($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-7')) {
        return $string;
    }
    $iso8859_7 = array(" " => '&#160;', "¡" => '&#8216;', "¢" => '&#8217;', "£" => '&#163;', "¦" => '&#166;', "§" => '&#167;', "¨" => '&#168;', "©" => '&#169;', "«" => '&#171;', "¬" => '&#172;', "­" => '&#173;', "¯" => '&#8213;', "°" => '&#176;', "±" => '&#177;', "²" => '&#178;', "³" => '&#179;', "´" => '&#900;', "µ" => '&#901;', "¶" => '&#902;', "·" => '&#183;', "¸" => '&#904;', "¹" => '&#905;', "º" => '&#906;', "»" => '&#187;', "¼" => '&#908;', "½" => '&#189;', "¾" => '&#910;', "¿" => '&#911;', "À" => '&#912;', "Á" => '&#913;', "Â" => '&#914;', "Ã" => '&#915;', "Ä" => '&#916;', "Å" => '&#917;', "Æ" => '&#918;', "Ç" => '&#919;', "È" => '&#920;', "É" => '&#921;', "Ê" => '&#922;', "Ë" => '&#923;', "Ì" => '&#924;', "Í" => '&#925;', "Î" => '&#926;', "Ï" => '&#927;', "Ð" => '&#928;', "Ñ" => '&#929;', "Ó" => '&#931;', "Ô" => '&#932;', "Õ" => '&#933;', "Ö" => '&#934;', "×" => '&#935;', "Ø" => '&#936;', "Ù" => '&#937;', "Ú" => '&#938;', "Û" => '&#939;', "Ü" => '&#940;', "Ý" => '&#941;', "Þ" => '&#942;', "ß" => '&#943;', "à" => '&#944;', "á" => '&#945;', "â" => '&#946;', "ã" => '&#947;', "ä" => '&#948;', "å" => '&#949;', "æ" => '&#950;', "ç" => '&#951;', "è" => '&#952;', "é" => '&#953;', "ê" => '&#954;', "ë" => '&#955;', "ì" => '&#956;', "í" => '&#957;', "î" => '&#958;', "ï" => '&#959;', "ð" => '&#960;', "ñ" => '&#961;', "ò" => '&#962;', "ó" => '&#963;', "ô" => '&#964;', "õ" => '&#965;', "ö" => '&#966;', "÷" => '&#967;', "ø" => '&#968;', "ù" => '&#969;', "ú" => '&#970;', "û" => '&#971;', "ü" => '&#972;', "ý" => '&#973;', "þ" => '&#974;');
    $string = str_replace(array_keys($iso8859_7), array_values($iso8859_7), $string);
    return $string;
}
Exemple #5
0
/**
 * Decode iso8859-8 encoded strings
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_8($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-8')) {
        return $string;
    }
    $iso8859_8 = array(" " => '&#160;', "¢" => '&#162;', "£" => '&#163;', "¤" => '&#164;', "¥" => '&#165;', "¦" => '&#166;', "§" => '&#167;', "¨" => '&#168;', "©" => '&#169;', "ª" => '&#215;', "«" => '&#171;', "¬" => '&#172;', "­" => '&#173;', "®" => '&#174;', "¯" => '&#175;', "°" => '&#176;', "±" => '&#177;', "²" => '&#178;', "³" => '&#179;', "´" => '&#180;', "µ" => '&#181;', "¶" => '&#182;', "·" => '&#183;', "¸" => '&#184;', "¹" => '&#185;', "º" => '&#247;', "»" => '&#187;', "¼" => '&#188;', "½" => '&#189;', "¾" => '&#190;', "ß" => '&#8215;', "à" => '&#1488;', "á" => '&#1489;', "â" => '&#1490;', "ã" => '&#1491;', "ä" => '&#1492;', "å" => '&#1493;', "æ" => '&#1494;', "ç" => '&#1495;', "è" => '&#1496;', "é" => '&#1497;', "ê" => '&#1498;', "ë" => '&#1499;', "ì" => '&#1500;', "í" => '&#1501;', "î" => '&#1502;', "ï" => '&#1503;', "ð" => '&#1504;', "ñ" => '&#1505;', "ò" => '&#1506;', "ó" => '&#1507;', "ô" => '&#1508;', "õ" => '&#1509;', "ö" => '&#1510;', "÷" => '&#1511;', "ø" => '&#1512;', "ù" => '&#1513;', "ú" => '&#1514;', "ý" => '&#8206;', "þ" => '&#8207;');
    $string = str_replace(array_keys($iso8859_8), array_values($iso8859_8), $string);
    return $string;
}
Exemple #6
0
/**
 * Decode iso8859-6 strings
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_6($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-6')) {
        return $string;
    }
    $iso8859_6 = array(" " => '&#160;', "¤" => '&#164;', "¬" => '&#1548;', "­" => '&#173;', "»" => '&#1563;', "¿" => '&#1567;', "Á" => '&#1569;', "Â" => '&#1570;', "Ã" => '&#1571;', "Ä" => '&#1572;', "Å" => '&#1573;', "Æ" => '&#1574;', "Ç" => '&#1575;', "È" => '&#1576;', "É" => '&#1577;', "Ê" => '&#1578;', "Ë" => '&#1579;', "Ì" => '&#1580;', "Í" => '&#1581;', "Î" => '&#1582;', "Ï" => '&#1583;', "Ð" => '&#1584;', "Ñ" => '&#1585;', "Ò" => '&#1586;', "Ó" => '&#1587;', "Ô" => '&#1588;', "Õ" => '&#1589;', "Ö" => '&#1590;', "×" => '&#1591;', "Ø" => '&#1592;', "Ù" => '&#1593;', "Ú" => '&#1594;', "à" => '&#1600;', "á" => '&#1601;', "â" => '&#1602;', "ã" => '&#1603;', "ä" => '&#1604;', "å" => '&#1605;', "æ" => '&#1606;', "ç" => '&#1607;', "è" => '&#1608;', "é" => '&#1609;', "ê" => '&#1610;', "ë" => '&#1611;', "ì" => '&#1612;', "í" => '&#1613;', "î" => '&#1614;', "ï" => '&#1615;', "ð" => '&#1616;', "ñ" => '&#1617;', "ò" => '&#1618;');
    $string = str_replace(array_keys($iso8859_6), array_values($iso8859_6), $string);
    return $string;
}
Exemple #7
0
/**
 * Decde a cp1258-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1258($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1258')) {
        return $string;
    }
    $cp1258 = array("�" => '&#8364;', "�" => '&#65533;', "�" => '&#8218;', "�" => '&#402;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#710;', "�" => '&#8240;', "�" => '&#65533;', "�" => '&#8249;', "�" => '&#338;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#732;', "�" => '&#8482;', "�" => '&#65533;', "�" => '&#8250;', "�" => '&#339;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#376;', "�" => '&#160;', "�" => '&#161;', "�" => '&#162;', "�" => '&#163;', "�" => '&#164;', "�" => '&#165;', "�" => '&#166;', "�" => '&#167;', "�" => '&#168;', "�" => '&#169;', "�" => '&#170;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#175;', "�" => '&#176;', "�" => '&#177;', "�" => '&#178;', "�" => '&#179;', "�" => '&#180;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#184;', "�" => '&#185;', "�" => '&#186;', "�" => '&#187;', "�" => '&#188;', "�" => '&#189;', "�" => '&#190;', "�" => '&#191;', "�" => '&#192;', "�" => '&#193;', "�" => '&#194;', "�" => '&#258;', "�" => '&#196;', "�" => '&#197;', "�" => '&#198;', "�" => '&#199;', "�" => '&#200;', "�" => '&#201;', "�" => '&#202;', "�" => '&#203;', "�" => '&#768;', "�" => '&#205;', "�" => '&#206;', "�" => '&#207;', "�" => '&#272;', "�" => '&#209;', "�" => '&#777;', "�" => '&#211;', "�" => '&#212;', "�" => '&#416;', "�" => '&#214;', "�" => '&#215;', "�" => '&#216;', "�" => '&#217;', "�" => '&#218;', "�" => '&#219;', "�" => '&#220;', "�" => '&#431;', "�" => '&#771;', "�" => '&#223;', "�" => '&#224;', "�" => '&#225;', "�" => '&#226;', "�" => '&#259;', "�" => '&#228;', "�" => '&#229;', "�" => '&#230;', "�" => '&#231;', "�" => '&#232;', "�" => '&#233;', "�" => '&#234;', "�" => '&#235;', "�" => '&#769;', "�" => '&#237;', "�" => '&#238;', "�" => '&#239;', "�" => '&#273;', "�" => '&#241;', "�" => '&#803;', "�" => '&#243;', "�" => '&#244;', "�" => '&#417;', "�" => '&#246;', "�" => '&#247;', "�" => '&#248;', "�" => '&#249;', "�" => '&#250;', "�" => '&#251;', "�" => '&#252;', "�" => '&#432;', "�" => '&#8363;', "�" => '&#255;');
    $string = str_replace(array_keys($cp1258), array_values($cp1258), $string);
    return $string;
}
Exemple #8
0
/**
 * Decode cp1251-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1251($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1251')) {
        return $string;
    }
    $cp1251 = array("�" => '&#1026;', "�" => '&#1027;', "�" => '&#8218;', "�" => '&#1107;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#8364;', "�" => '&#8240;', "�" => '&#1033;', "�" => '&#8249;', "�" => '&#1034;', "�" => '&#1036;', "�" => '&#1035;', "�" => '&#1039;', "�" => '&#1106;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#65533;', "�" => '&#8482;', "�" => '&#1113;', "�" => '&#8250;', "�" => '&#1114;', "�" => '&#1116;', "�" => '&#1115;', "�" => '&#1119;', "�" => '&#160;', "�" => '&#1038;', "�" => '&#1118;', "�" => '&#1032;', "�" => '&#164;', "�" => '&#1168;', "�" => '&#166;', "�" => '&#167;', "�" => '&#1025;', "�" => '&#169;', "�" => '&#1028;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#1031;', "�" => '&#176;', "�" => '&#177;', "�" => '&#1030;', "�" => '&#1110;', "�" => '&#1169;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#1105;', "�" => '&#8470;', "�" => '&#1108;', "�" => '&#187;', "�" => '&#1112;', "�" => '&#1029;', "�" => '&#1109;', "�" => '&#1111;', "�" => '&#1040;', "�" => '&#1041;', "�" => '&#1042;', "�" => '&#1043;', "�" => '&#1044;', "�" => '&#1045;', "�" => '&#1046;', "�" => '&#1047;', "�" => '&#1048;', "�" => '&#1049;', "�" => '&#1050;', "�" => '&#1051;', "�" => '&#1052;', "�" => '&#1053;', "�" => '&#1054;', "�" => '&#1055;', "�" => '&#1056;', "�" => '&#1057;', "�" => '&#1058;', "�" => '&#1059;', "�" => '&#1060;', "�" => '&#1061;', "�" => '&#1062;', "�" => '&#1063;', "�" => '&#1064;', "�" => '&#1065;', "�" => '&#1066;', "�" => '&#1067;', "�" => '&#1068;', "�" => '&#1069;', "�" => '&#1070;', "�" => '&#1071;', "�" => '&#1072;', "�" => '&#1073;', "�" => '&#1074;', "�" => '&#1075;', "�" => '&#1076;', "�" => '&#1077;', "�" => '&#1078;', "�" => '&#1079;', "�" => '&#1080;', "�" => '&#1081;', "�" => '&#1082;', "�" => '&#1083;', "�" => '&#1084;', "�" => '&#1085;', "�" => '&#1086;', "�" => '&#1087;', "�" => '&#1088;', "�" => '&#1089;', "�" => '&#1090;', "�" => '&#1091;', "�" => '&#1092;', "�" => '&#1093;', "�" => '&#1094;', "�" => '&#1095;', "�" => '&#1096;', "�" => '&#1097;', "�" => '&#1098;', "�" => '&#1099;', "�" => '&#1100;', "�" => '&#1101;', "�" => '&#1102;', "�" => '&#1103;');
    $string = str_replace(array_keys($cp1251), array_values($cp1251), $string);
    return $string;
}
Exemple #9
0
/**
 * Decode iso8859-11 string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_11($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-11')) {
        return $string;
    }
    $iso8859_11 = array(" " => '&#160;', "¡" => '&#3585;', "¢" => '&#3586;', "£" => '&#3587;', "¤" => '&#3588;', "¥" => '&#3589;', "¦" => '&#3590;', "§" => '&#3591;', "¨" => '&#3592;', "©" => '&#3593;', "ª" => '&#3594;', "«" => '&#3595;', "¬" => '&#3596;', "­" => '&#3597;', "®" => '&#3598;', "¯" => '&#3599;', "°" => '&#3600;', "±" => '&#3601;', "²" => '&#3602;', "³" => '&#3603;', "´" => '&#3604;', "µ" => '&#3605;', "¶" => '&#3606;', "·" => '&#3607;', "¸" => '&#3608;', "¹" => '&#3609;', "º" => '&#3610;', "»" => '&#3611;', "¼" => '&#3612;', "½" => '&#3613;', "¾" => '&#3614;', "¿" => '&#3615;', "À" => '&#3616;', "Á" => '&#3617;', "Â" => '&#3618;', "Ã" => '&#3619;', "Ä" => '&#3620;', "Å" => '&#3621;', "Æ" => '&#3622;', "Ç" => '&#3623;', "È" => '&#3624;', "É" => '&#3625;', "Ê" => '&#3626;', "Ë" => '&#3627;', "Ì" => '&#3628;', "Í" => '&#3629;', "Î" => '&#3630;', "Ï" => '&#3631;', "Ð" => '&#3632;', "Ñ" => '&#3633;', "Ò" => '&#3634;', "Ó" => '&#3635;', "Ô" => '&#3636;', "Õ" => '&#3637;', "Ö" => '&#3638;', "×" => '&#3639;', "Ø" => '&#3640;', "Ù" => '&#3641;', "Ú" => '&#3642;', "ß" => '&#3647;', "à" => '&#3648;', "á" => '&#3649;', "â" => '&#3650;', "ã" => '&#3651;', "ä" => '&#3652;', "å" => '&#3653;', "æ" => '&#3654;', "ç" => '&#3655;', "è" => '&#3656;', "é" => '&#3657;', "ê" => '&#3658;', "ë" => '&#3659;', "ì" => '&#3660;', "í" => '&#3661;', "î" => '&#3662;', "ï" => '&#3663;', "ð" => '&#3664;', "ñ" => '&#3665;', "ò" => '&#3666;', "ó" => '&#3667;', "ô" => '&#3668;', "õ" => '&#3669;', "ö" => '&#3670;', "÷" => '&#3671;', "ø" => '&#3672;', "ù" => '&#3673;', "ú" => '&#3674;', "û" => '&#3675;');
    $string = str_replace(array_keys($iso8859_11), array_values($iso8859_11), $string);
    return $string;
}
Exemple #10
0
/**
 * Decode cp1253-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1253($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1253')) {
        return $string;
    }
    $cp1253 = array("�" => '&#8364;', "�" => '&#65533;', "�" => '&#8218;', "�" => '&#402;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#65533;', "�" => '&#8240;', "�" => '&#65533;', "�" => '&#8249;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#65533;', "�" => '&#8482;', "�" => '&#65533;', "�" => '&#8250;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#160;', "�" => '&#901;', "�" => '&#902;', "�" => '&#163;', "�" => '&#164;', "�" => '&#165;', "�" => '&#166;', "�" => '&#167;', "�" => '&#168;', "�" => '&#169;', "�" => '&#65533;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#8213;', "�" => '&#176;', "�" => '&#177;', "�" => '&#178;', "�" => '&#179;', "�" => '&#900;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#904;', "�" => '&#905;', "�" => '&#906;', "�" => '&#187;', "�" => '&#908;', "�" => '&#189;', "�" => '&#910;', "�" => '&#911;', "�" => '&#912;', "�" => '&#913;', "�" => '&#914;', "�" => '&#915;', "�" => '&#916;', "�" => '&#917;', "�" => '&#918;', "�" => '&#919;', "�" => '&#920;', "�" => '&#921;', "�" => '&#922;', "�" => '&#923;', "�" => '&#924;', "�" => '&#925;', "�" => '&#926;', "�" => '&#927;', "�" => '&#928;', "�" => '&#929;', "�" => '&#65533;', "�" => '&#931;', "�" => '&#932;', "�" => '&#933;', "�" => '&#934;', "�" => '&#935;', "�" => '&#936;', "�" => '&#937;', "�" => '&#938;', "�" => '&#939;', "�" => '&#940;', "�" => '&#941;', "�" => '&#942;', "�" => '&#943;', "�" => '&#944;', "�" => '&#945;', "�" => '&#946;', "�" => '&#947;', "�" => '&#948;', "�" => '&#949;', "�" => '&#950;', "�" => '&#951;', "�" => '&#952;', "�" => '&#953;', "�" => '&#954;', "�" => '&#955;', "�" => '&#956;', "�" => '&#957;', "�" => '&#958;', "�" => '&#959;', "�" => '&#960;', "�" => '&#961;', "�" => '&#962;', "�" => '&#963;', "�" => '&#964;', "�" => '&#965;', "�" => '&#966;', "�" => '&#967;', "�" => '&#968;', "�" => '&#969;', "�" => '&#970;', "�" => '&#971;', "�" => '&#972;', "�" => '&#973;', "�" => '&#974;', "�" => '&#65533;');
    $string = str_replace(array_keys($cp1253), array_values($cp1253), $string);
    return $string;
}
Exemple #11
0
/**
 * Decode iso8859-13
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_13($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-13')) {
        return $string;
    }
    $iso8859_13 = array(" " => '&#160;', "¡" => '&#8221;', "¢" => '&#162;', "£" => '&#163;', "¤" => '&#164;', "¥" => '&#8222;', "¦" => '&#166;', "§" => '&#167;', "¨" => '&#216;', "©" => '&#169;', "ª" => '&#342;', "«" => '&#171;', "¬" => '&#172;', "­" => '&#173;', "®" => '&#174;', "¯" => '&#198;', "°" => '&#176;', "±" => '&#177;', "²" => '&#178;', "³" => '&#179;', "´" => '&#8220;', "µ" => '&#181;', "¶" => '&#182;', "·" => '&#183;', "¸" => '&#248;', "¹" => '&#185;', "º" => '&#343;', "»" => '&#187;', "¼" => '&#188;', "½" => '&#189;', "¾" => '&#190;', "¿" => '&#230;', "À" => '&#260;', "Á" => '&#302;', "Â" => '&#256;', "Ã" => '&#262;', "Ä" => '&#196;', "Å" => '&#197;', "Æ" => '&#280;', "Ç" => '&#274;', "È" => '&#268;', "É" => '&#201;', "Ê" => '&#377;', "Ë" => '&#278;', "Ì" => '&#290;', "Í" => '&#310;', "Î" => '&#298;', "Ï" => '&#315;', "Ð" => '&#352;', "Ñ" => '&#323;', "Ò" => '&#325;', "Ó" => '&#211;', "Ô" => '&#332;', "Õ" => '&#213;', "Ö" => '&#214;', "×" => '&#215;', "Ø" => '&#370;', "Ù" => '&#321;', "Ú" => '&#346;', "Û" => '&#362;', "Ü" => '&#220;', "Ý" => '&#379;', "Þ" => '&#381;', "ß" => '&#223;', "à" => '&#261;', "á" => '&#303;', "â" => '&#257;', "ã" => '&#263;', "ä" => '&#228;', "å" => '&#229;', "æ" => '&#281;', "ç" => '&#275;', "è" => '&#269;', "é" => '&#233;', "ê" => '&#378;', "ë" => '&#279;', "ì" => '&#291;', "í" => '&#311;', "î" => '&#299;', "ï" => '&#316;', "ð" => '&#353;', "ñ" => '&#324;', "ò" => '&#326;', "ó" => '&#243;', "ô" => '&#333;', "õ" => '&#245;', "ö" => '&#246;', "÷" => '&#247;', "ø" => '&#371;', "ù" => '&#322;', "ú" => '&#347;', "û" => '&#363;', "ü" => '&#252;', "ý" => '&#380;', "þ" => '&#382;', "ÿ" => '&#8217;');
    $string = str_replace(array_keys($iso8859_13), array_values($iso8859_13), $string);
    return $string;
}
Exemple #12
0
/**
 * Decode iso-ir-111 encoded strings
 * @param string $string Encoded string
 * @return string Decoded string
 */
function charset_decode_iso_ir_111($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-ir-111')) {
        return $string;
    }
    $iso_ir_111 = array(" " => '&#160;', "¡" => '&#1106;', "¢" => '&#1107;', "£" => '&#1105;', "¤" => '&#1108;', "¥" => '&#1109;', "¦" => '&#1110;', "§" => '&#1111;', "¨" => '&#1112;', "©" => '&#1113;', "ª" => '&#1114;', "«" => '&#1115;', "¬" => '&#1116;', "­" => '&#173;', "®" => '&#1118;', "¯" => '&#1119;', "°" => '&#8470;', "±" => '&#1026;', "²" => '&#1027;', "³" => '&#1025;', "´" => '&#1028;', "µ" => '&#1029;', "¶" => '&#1030;', "·" => '&#1031;', "¸" => '&#1032;', "¹" => '&#1033;', "º" => '&#1034;', "»" => '&#1035;', "¼" => '&#1036;', "½" => '&#164;', "¾" => '&#1038;', "¿" => '&#1039;', "À" => '&#1102;', "Á" => '&#1072;', "Â" => '&#1073;', "Ã" => '&#1094;', "Ä" => '&#1076;', "Å" => '&#1077;', "Æ" => '&#1092;', "Ç" => '&#1075;', "È" => '&#1093;', "É" => '&#1080;', "Ê" => '&#1081;', "Ë" => '&#1082;', "Ì" => '&#1083;', "Í" => '&#1084;', "Î" => '&#1085;', "Ï" => '&#1086;', "Ð" => '&#1087;', "Ñ" => '&#1103;', "Ò" => '&#1088;', "Ó" => '&#1089;', "Ô" => '&#1090;', "Õ" => '&#1091;', "Ö" => '&#1078;', "×" => '&#1074;', "Ø" => '&#1100;', "Ù" => '&#1099;', "Ú" => '&#1079;', "Û" => '&#1096;', "Ü" => '&#1101;', "Ý" => '&#1097;', "Þ" => '&#1095;', "ß" => '&#1098;', "à" => '&#1070;', "á" => '&#1040;', "â" => '&#1041;', "ã" => '&#1062;', "ä" => '&#1044;', "å" => '&#1045;', "æ" => '&#1060;', "ç" => '&#1043;', "è" => '&#1061;', "é" => '&#1048;', "ê" => '&#1049;', "ë" => '&#1050;', "ì" => '&#1051;', "í" => '&#1052;', "î" => '&#1053;', "ï" => '&#1054;', "ð" => '&#1055;', "ñ" => '&#1071;', "ò" => '&#1056;', "ó" => '&#1057;', "ô" => '&#1058;', "õ" => '&#1059;', "ö" => '&#1046;', "÷" => '&#1042;', "ø" => '&#1068;', "ù" => '&#1067;', "ú" => '&#1047;', "û" => '&#1064;', "ü" => '&#1069;', "ý" => '&#1065;', "þ" => '&#1063;', "ÿ" => '&#1066;');
    $string = str_replace(array_keys($iso_ir_111), array_values($iso_ir_111), $string);
    return $string;
}
Exemple #13
0
/**
 * Decode a cp855-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp855($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'ibm855')) {
        return $string;
    }
    $cp855 = array("�" => '&#1106;', "�" => '&#1026;', "�" => '&#1107;', "�" => '&#1027;', "�" => '&#1105;', "�" => '&#1025;', "�" => '&#1108;', "�" => '&#1028;', "�" => '&#1109;', "�" => '&#1029;', "�" => '&#1110;', "�" => '&#1030;', "�" => '&#1111;', "�" => '&#1031;', "�" => '&#1112;', "�" => '&#1032;', "�" => '&#1113;', "�" => '&#1033;', "�" => '&#1114;', "�" => '&#1034;', "�" => '&#1115;', "�" => '&#1035;', "�" => '&#1116;', "�" => '&#1036;', "�" => '&#1118;', "�" => '&#1038;', "�" => '&#1119;', "�" => '&#1039;', "�" => '&#1102;', "�" => '&#1070;', "�" => '&#1098;', "�" => '&#1066;', "�" => '&#1072;', "�" => '&#1040;', "�" => '&#1073;', "�" => '&#1041;', "�" => '&#1094;', "�" => '&#1062;', "�" => '&#1076;', "�" => '&#1044;', "�" => '&#1077;', "�" => '&#1045;', "�" => '&#1092;', "�" => '&#1060;', "�" => '&#1075;', "�" => '&#1043;', "�" => '&#171;', "�" => '&#187;', "�" => '&#9617;', "�" => '&#9618;', "�" => '&#9619;', "�" => '&#9474;', "�" => '&#9508;', "�" => '&#1093;', "�" => '&#1061;', "�" => '&#1080;', "�" => '&#1048;', "�" => '&#9571;', "�" => '&#9553;', "�" => '&#9559;', "�" => '&#9565;', "�" => '&#1081;', "�" => '&#1049;', "�" => '&#9488;', "�" => '&#9492;', "�" => '&#9524;', "�" => '&#9516;', "�" => '&#9500;', "�" => '&#9472;', "�" => '&#9532;', "�" => '&#1082;', "�" => '&#1050;', "�" => '&#9562;', "�" => '&#9556;', "�" => '&#9577;', "�" => '&#9574;', "�" => '&#9568;', "�" => '&#9552;', "�" => '&#9580;', "�" => '&#164;', "�" => '&#1083;', "�" => '&#1051;', "�" => '&#1084;', "�" => '&#1052;', "�" => '&#1085;', "�" => '&#1053;', "�" => '&#1086;', "�" => '&#1054;', "�" => '&#1087;', "�" => '&#9496;', "�" => '&#9484;', "�" => '&#9608;', "�" => '&#9604;', "�" => '&#1055;', "�" => '&#1103;', "�" => '&#9600;', "�" => '&#1071;', "�" => '&#1088;', "�" => '&#1056;', "�" => '&#1089;', "�" => '&#1057;', "�" => '&#1090;', "�" => '&#1058;', "�" => '&#1091;', "�" => '&#1059;', "�" => '&#1078;', "�" => '&#1046;', "�" => '&#1074;', "�" => '&#1042;', "�" => '&#1100;', "�" => '&#1068;', "�" => '&#8470;', "�" => '&#173;', "�" => '&#1099;', "�" => '&#1067;', "�" => '&#1079;', "�" => '&#1047;', "�" => '&#1096;', "�" => '&#1064;', "�" => '&#1101;', "�" => '&#1069;', "�" => '&#1097;', "�" => '&#1065;', "�" => '&#1095;', "�" => '&#1063;', "�" => '&#167;', "�" => '&#9632;', "�" => '&#160;');
    $string = str_replace(array_keys($cp855), array_values($cp855), $string);
    return $string;
}
Exemple #14
0
/**
 * Decode iso8859-15 encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_15($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-15')) {
        return $string;
    }
    $iso8859_15 = array(" " => '&#160;', "¡" => '&#161;', "¢" => '&#162;', "£" => '&#163;', "¤" => '&#8364;', "¥" => '&#165;', "¦" => '&#352;', "§" => '&#167;', "¨" => '&#353;', "©" => '&#169;', "ª" => '&#170;', "«" => '&#171;', "¬" => '&#172;', "­" => '&#173;', "®" => '&#174;', "¯" => '&#175;', "°" => '&#176;', "±" => '&#177;', "²" => '&#178;', "³" => '&#179;', "´" => '&#381;', "µ" => '&#181;', "¶" => '&#182;', "·" => '&#183;', "¸" => '&#382;', "¹" => '&#185;', "º" => '&#186;', "»" => '&#187;', "¼" => '&#338;', "½" => '&#339;', "¾" => '&#376;', "¿" => '&#191;', "À" => '&#192;', "Á" => '&#193;', "Â" => '&#194;', "Ã" => '&#195;', "Ä" => '&#196;', "Å" => '&#197;', "Æ" => '&#198;', "Ç" => '&#199;', "È" => '&#200;', "É" => '&#201;', "Ê" => '&#202;', "Ë" => '&#203;', "Ì" => '&#204;', "Í" => '&#205;', "Î" => '&#206;', "Ï" => '&#207;', "Ð" => '&#208;', "Ñ" => '&#209;', "Ò" => '&#210;', "Ó" => '&#211;', "Ô" => '&#212;', "Õ" => '&#213;', "Ö" => '&#214;', "×" => '&#215;', "Ø" => '&#216;', "Ù" => '&#217;', "Ú" => '&#218;', "Û" => '&#219;', "Ü" => '&#220;', "Ý" => '&#221;', "Þ" => '&#222;', "ß" => '&#223;', "à" => '&#224;', "á" => '&#225;', "â" => '&#226;', "ã" => '&#227;', "ä" => '&#228;', "å" => '&#229;', "æ" => '&#230;', "ç" => '&#231;', "è" => '&#232;', "é" => '&#233;', "ê" => '&#234;', "ë" => '&#235;', "ì" => '&#236;', "í" => '&#237;', "î" => '&#238;', "ï" => '&#239;', "ð" => '&#240;', "ñ" => '&#241;', "ò" => '&#242;', "ó" => '&#243;', "ô" => '&#244;', "õ" => '&#245;', "ö" => '&#246;', "÷" => '&#247;', "ø" => '&#248;', "ù" => '&#249;', "ú" => '&#250;', "û" => '&#251;', "ü" => '&#252;', "ý" => '&#253;', "þ" => '&#254;', "ÿ" => '&#255;');
    $string = str_replace(array_keys($iso8859_15), array_values($iso8859_15), $string);
    return $string;
}
Exemple #15
0
/**
 * Decode cp1255-encoded string
 * @param string $string Encoded string
 * @return string $string decoded string
 */
function charset_decode_cp1255($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1255')) {
        return $string;
    }
    $cp1255 = array("�" => '&#8364;', "�" => '&#65533;', "�" => '&#8218;', "�" => '&#402;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#710;', "�" => '&#8240;', "�" => '&#65533;', "�" => '&#8249;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#732;', "�" => '&#8482;', "�" => '&#65533;', "�" => '&#8250;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#160;', "�" => '&#161;', "�" => '&#162;', "�" => '&#163;', "�" => '&#8362;', "�" => '&#165;', "�" => '&#166;', "�" => '&#167;', "�" => '&#168;', "�" => '&#169;', "�" => '&#215;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#175;', "�" => '&#176;', "�" => '&#177;', "�" => '&#178;', "�" => '&#179;', "�" => '&#180;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#184;', "�" => '&#185;', "�" => '&#247;', "�" => '&#187;', "�" => '&#188;', "�" => '&#189;', "�" => '&#190;', "�" => '&#191;', "�" => '&#1456;', "�" => '&#1457;', "�" => '&#1458;', "�" => '&#1459;', "�" => '&#1460;', "�" => '&#1461;', "�" => '&#1462;', "�" => '&#1463;', "�" => '&#1464;', "�" => '&#1465;', "�" => '&#65533;', "�" => '&#1467;', "�" => '&#1468;', "�" => '&#1469;', "�" => '&#1470;', "�" => '&#1471;', "�" => '&#1472;', "�" => '&#1473;', "�" => '&#1474;', "�" => '&#1475;', "�" => '&#1520;', "�" => '&#1521;', "�" => '&#1522;', "�" => '&#1523;', "�" => '&#1524;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#1488;', "�" => '&#1489;', "�" => '&#1490;', "�" => '&#1491;', "�" => '&#1492;', "�" => '&#1493;', "�" => '&#1494;', "�" => '&#1495;', "�" => '&#1496;', "�" => '&#1497;', "�" => '&#1498;', "�" => '&#1499;', "�" => '&#1500;', "�" => '&#1501;', "�" => '&#1502;', "�" => '&#1503;', "�" => '&#1504;', "�" => '&#1505;', "�" => '&#1506;', "�" => '&#1507;', "�" => '&#1508;', "�" => '&#1509;', "�" => '&#1510;', "�" => '&#1511;', "�" => '&#1512;', "�" => '&#1513;', "�" => '&#1514;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#8206;', "�" => '&#8207;', "�" => '&#65533;');
    $string = str_replace(array_keys($cp1255), array_values($cp1255), $string);
    return $string;
}
Exemple #16
0
/**
 * Decode cp10006 (MacGreek) string
 * @param string $string String to decode
 * @return string $string Decoded string
 */
function charset_decode_cp10006($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'cp10006')) {
        return $string;
    }
    $cp10006 = array("x80" => '&#196;', "x81" => '&#185;', "x82" => '&#178;', "x83" => '&#201;', "x84" => '&#179;', "x85" => '&#214;', "x86" => '&#220;', "x87" => '&#901;', "x88" => '&#224;', "x89" => '&#226;', "x8A" => '&#228;', "x8B" => '&#900;', "x8C" => '&#168;', "x8D" => '&#231;', "x8E" => '&#233;', "x8F" => '&#232;', "x90" => '&#234;', "x91" => '&#235;', "x92" => '&#163;', "x93" => '&#8482;', "x94" => '&#238;', "x95" => '&#239;', "x96" => '&#8226;', "x97" => '&#189;', "x98" => '&#8240;', "x99" => '&#244;', "x9A" => '&#246;', "x9B" => '&#166;', "x9C" => '&#173;', "x9D" => '&#249;', "x9E" => '&#251;', "x9F" => '&#252;', "xA0" => '&#8224;', "xA1" => '&#915;', "xA2" => '&#916;', "xA3" => '&#920;', "xA4" => '&#923;', "xA5" => '&#926;', "xA6" => '&#928;', "xA7" => '&#223;', "xA8" => '&#174;', "xA9" => '&#169;', "xAA" => '&#931;', "xAB" => '&#938;', "xAC" => '&#167;', "xAD" => '&#8800;', "xAE" => '&#176;', "xAF" => '&#903;', "xB0" => '&#913;', "xB1" => '&#177;', "xB2" => '&#8804;', "xB3" => '&#8805;', "xB4" => '&#165;', "xB5" => '&#914;', "xB6" => '&#917;', "xB7" => '&#918;', "xB8" => '&#919;', "xB9" => '&#921;', "xBA" => '&#922;', "xBB" => '&#924;', "xBC" => '&#934;', "xBD" => '&#939;', "xBE" => '&#936;', "xBF" => '&#937;', "xC0" => '&#940;', "xC1" => '&#925;', "xC2" => '&#172;', "xC3" => '&#927;', "xC4" => '&#929;', "xC5" => '&#8776;', "xC6" => '&#932;', "xC7" => '&#171;', "xC8" => '&#187;', "xC9" => '&#8230;', "xCA" => '&#160;', "xCB" => '&#933;', "xCC" => '&#935;', "xCD" => '&#902;', "xCE" => '&#904;', "xCF" => '&#339;', "xD0" => '&#8211;', "xD1" => '&#8213;', "xD2" => '&#8220;', "xD3" => '&#8221;', "xD4" => '&#8216;', "xD5" => '&#8217;', "xD6" => '&#247;', "xD7" => '&#905;', "xD8" => '&#906;', "xD9" => '&#908;', "xDA" => '&#910;', "xDB" => '&#941;', "xDC" => '&#942;', "xDD" => '&#943;', "xDE" => '&#972;', "xDF" => '&#911;', "xE0" => '&#973;', "xE1" => '&#945;', "xE2" => '&#946;', "xE3" => '&#968;', "xE4" => '&#948;', "xE5" => '&#949;', "xE6" => '&#966;', "xE7" => '&#947;', "xE8" => '&#951;', "xE9" => '&#953;', "xEA" => '&#958;', "xEB" => '&#954;', "xEC" => '&#955;', "xED" => '&#956;', "xEE" => '&#957;', "xEF" => '&#959;', "xF0" => '&#960;', "xF1" => '&#974;', "xF2" => '&#961;', "xF3" => '&#963;', "xF4" => '&#964;', "xF5" => '&#952;', "xF6" => '&#969;', "xF7" => '&#962;', "xF8" => '&#967;', "xF9" => '&#965;', "xFA" => '&#950;', "xFB" => '&#970;', "xFC" => '&#971;', "xFD" => '&#912;', "xFE" => '&#944;', "xFF" => '&#65535;');
    $string = str_replace(array_keys($cp10006), array_values($cp10006), $string);
    return $string;
}
Exemple #17
0
/**
 * Decode cp10081(MacTurkish) encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp10081($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'cp10081')) {
        return $string;
    }
    $cp10081 = array("x80" => '&#196;', "x81" => '&#197;', "x82" => '&#199;', "x83" => '&#201;', "x84" => '&#209;', "x85" => '&#214;', "x86" => '&#220;', "x87" => '&#225;', "x88" => '&#224;', "x89" => '&#226;', "x8A" => '&#228;', "x8B" => '&#227;', "x8C" => '&#229;', "x8D" => '&#231;', "x8E" => '&#233;', "x8F" => '&#232;', "x90" => '&#234;', "x91" => '&#235;', "x92" => '&#237;', "x93" => '&#236;', "x94" => '&#238;', "x95" => '&#239;', "x96" => '&#241;', "x97" => '&#243;', "x98" => '&#242;', "x99" => '&#244;', "x9A" => '&#246;', "x9B" => '&#245;', "x9C" => '&#250;', "x9D" => '&#249;', "x9E" => '&#251;', "x9F" => '&#252;', "xA0" => '&#8224;', "xA1" => '&#176;', "xA2" => '&#162;', "xA3" => '&#163;', "xA4" => '&#167;', "xA5" => '&#8226;', "xA6" => '&#182;', "xA7" => '&#223;', "xA8" => '&#174;', "xA9" => '&#169;', "xAA" => '&#8482;', "xAB" => '&#180;', "xAC" => '&#168;', "xAD" => '&#8800;', "xAE" => '&#198;', "xAF" => '&#216;', "xB0" => '&#8734;', "xB1" => '&#177;', "xB2" => '&#8804;', "xB3" => '&#8805;', "xB4" => '&#165;', "xB5" => '&#181;', "xB6" => '&#8706;', "xB7" => '&#8721;', "xB8" => '&#8719;', "xB9" => '&#960;', "xBA" => '&#8747;', "xBB" => '&#170;', "xBC" => '&#186;', "xBD" => '&#8486;', "xBE" => '&#230;', "xBF" => '&#248;', "xC0" => '&#191;', "xC1" => '&#161;', "xC2" => '&#172;', "xC3" => '&#8730;', "xC4" => '&#402;', "xC5" => '&#8776;', "xC6" => '&#8710;', "xC7" => '&#171;', "xC8" => '&#187;', "xC9" => '&#8230;', "xCA" => '&#160;', "xCB" => '&#192;', "xCC" => '&#195;', "xCD" => '&#213;', "xCE" => '&#338;', "xCF" => '&#339;', "xD0" => '&#8211;', "xD1" => '&#8212;', "xD2" => '&#8220;', "xD3" => '&#8221;', "xD4" => '&#8216;', "xD5" => '&#8217;', "xD6" => '&#247;', "xD7" => '&#9674;', "xD8" => '&#255;', "xD9" => '&#376;', "xDA" => '&#286;', "xDB" => '&#287;', "xDC" => '&#304;', "xDD" => '&#305;', "xDE" => '&#350;', "xDF" => '&#351;', "xE0" => '&#8225;', "xE1" => '&#183;', "xE2" => '&#8218;', "xE3" => '&#8222;', "xE4" => '&#8240;', "xE5" => '&#194;', "xE6" => '&#202;', "xE7" => '&#193;', "xE8" => '&#203;', "xE9" => '&#200;', "xEA" => '&#205;', "xEB" => '&#206;', "xEC" => '&#207;', "xED" => '&#204;', "xEE" => '&#211;', "xEF" => '&#212;', "xF0" => '&#65535;', "xF1" => '&#210;', "xF2" => '&#218;', "xF3" => '&#219;', "xF4" => '&#217;', "xF5" => '&#65535;', "xF6" => '&#710;', "xF7" => '&#732;', "xF8" => '&#175;', "xF9" => '&#728;', "xFA" => '&#729;', "xFB" => '&#730;', "xFC" => '&#184;', "xFD" => '&#733;', "xFE" => '&#731;', "xFF" => '&#711;');
    $string = str_replace(array_keys($cp10081), array_values($cp10081), $string);
    return $string;
}
Exemple #18
0
/**
 * Decode iso8859-2 encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_2($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-2')) {
        return $string;
    }
    $iso8859_2 = array(" " => '&#160;', "¡" => '&#260;', "¢" => '&#728;', "£" => '&#321;', "¤" => '&#164;', "¥" => '&#317;', "¦" => '&#346;', "§" => '&#167;', "¨" => '&#168;', "©" => '&#352;', "ª" => '&#350;', "«" => '&#356;', "¬" => '&#377;', "­" => '&#173;', "®" => '&#381;', "¯" => '&#379;', "°" => '&#176;', "±" => '&#261;', "²" => '&#731;', "³" => '&#322;', "´" => '&#180;', "µ" => '&#318;', "¶" => '&#347;', "·" => '&#711;', "¸" => '&#184;', "¹" => '&#353;', "º" => '&#351;', "»" => '&#357;', "¼" => '&#378;', "½" => '&#733;', "¾" => '&#382;', "¿" => '&#380;', "À" => '&#340;', "Á" => '&#193;', "Â" => '&#194;', "Ã" => '&#258;', "Ä" => '&#196;', "Å" => '&#313;', "Æ" => '&#262;', "Ç" => '&#199;', "È" => '&#268;', "É" => '&#201;', "Ê" => '&#280;', "Ë" => '&#203;', "Ì" => '&#282;', "Í" => '&#205;', "Î" => '&#206;', "Ï" => '&#270;', "Ð" => '&#272;', "Ñ" => '&#323;', "Ò" => '&#327;', "Ó" => '&#211;', "Ô" => '&#212;', "Õ" => '&#336;', "Ö" => '&#214;', "×" => '&#215;', "Ø" => '&#344;', "Ù" => '&#366;', "Ú" => '&#218;', "Û" => '&#368;', "Ü" => '&#220;', "Ý" => '&#221;', "Þ" => '&#354;', "ß" => '&#223;', "à" => '&#341;', "á" => '&#225;', "â" => '&#226;', "ã" => '&#259;', "ä" => '&#228;', "å" => '&#314;', "æ" => '&#263;', "ç" => '&#231;', "è" => '&#269;', "é" => '&#233;', "ê" => '&#281;', "ë" => '&#235;', "ì" => '&#283;', "í" => '&#237;', "î" => '&#238;', "ï" => '&#271;', "ð" => '&#273;', "ñ" => '&#324;', "ò" => '&#328;', "ó" => '&#243;', "ô" => '&#244;', "õ" => '&#337;', "ö" => '&#246;', "÷" => '&#247;', "ø" => '&#345;', "ù" => '&#367;', "ú" => '&#250;', "û" => '&#369;', "ü" => '&#252;', "ý" => '&#253;', "þ" => '&#355;', "ÿ" => '&#729;');
    $string = str_replace(array_keys($iso8859_2), array_values($iso8859_2), $string);
    return $string;
}
Exemple #19
0
/**
 * Decode iso8859-3 encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_3($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-3')) {
        return $string;
    }
    $iso8859_3 = array(" " => '&#160;', "¡" => '&#294;', "¢" => '&#728;', "£" => '&#163;', "¤" => '&#164;', "¦" => '&#292;', "§" => '&#167;', "¨" => '&#168;', "©" => '&#304;', "ª" => '&#350;', "«" => '&#286;', "¬" => '&#308;', "­" => '&#173;', "¯" => '&#379;', "°" => '&#176;', "±" => '&#295;', "²" => '&#178;', "³" => '&#179;', "´" => '&#180;', "µ" => '&#181;', "¶" => '&#293;', "·" => '&#183;', "¸" => '&#184;', "¹" => '&#305;', "º" => '&#351;', "»" => '&#287;', "¼" => '&#309;', "½" => '&#189;', "¿" => '&#380;', "À" => '&#192;', "Á" => '&#193;', "Â" => '&#194;', "Ä" => '&#196;', "Å" => '&#266;', "Æ" => '&#264;', "Ç" => '&#199;', "È" => '&#200;', "É" => '&#201;', "Ê" => '&#202;', "Ë" => '&#203;', "Ì" => '&#204;', "Í" => '&#205;', "Î" => '&#206;', "Ï" => '&#207;', "Ñ" => '&#209;', "Ò" => '&#210;', "Ó" => '&#211;', "Ô" => '&#212;', "Õ" => '&#288;', "Ö" => '&#214;', "×" => '&#215;', "Ø" => '&#284;', "Ù" => '&#217;', "Ú" => '&#218;', "Û" => '&#219;', "Ü" => '&#220;', "Ý" => '&#364;', "Þ" => '&#348;', "ß" => '&#223;', "à" => '&#224;', "á" => '&#225;', "â" => '&#226;', "ä" => '&#228;', "å" => '&#267;', "æ" => '&#265;', "ç" => '&#231;', "è" => '&#232;', "é" => '&#233;', "ê" => '&#234;', "ë" => '&#235;', "ì" => '&#236;', "í" => '&#237;', "î" => '&#238;', "ï" => '&#239;', "ñ" => '&#241;', "ò" => '&#242;', "ó" => '&#243;', "ô" => '&#244;', "õ" => '&#289;', "ö" => '&#246;', "÷" => '&#247;', "ø" => '&#285;', "ù" => '&#249;', "ú" => '&#250;', "û" => '&#251;', "ü" => '&#252;', "ý" => '&#365;', "þ" => '&#349;', "ÿ" => '&#729;');
    $string = str_replace(array_keys($iso8859_3), array_values($iso8859_3), $string);
    return $string;
}
Exemple #20
0
/**
 * Decode cp10029 (MacLatin2) string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp10029($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'cp10029')) {
        return $string;
    }
    $cp10029 = array("x80" => '&#196;', "x81" => '&#256;', "x82" => '&#257;', "x83" => '&#201;', "x84" => '&#260;', "x85" => '&#214;', "x86" => '&#220;', "x87" => '&#225;', "x88" => '&#261;', "x89" => '&#268;', "x8A" => '&#228;', "x8B" => '&#269;', "x8C" => '&#262;', "x8D" => '&#263;', "x8E" => '&#233;', "x8F" => '&#377;', "x90" => '&#378;', "x91" => '&#270;', "x92" => '&#237;', "x93" => '&#271;', "x94" => '&#274;', "x95" => '&#275;', "x96" => '&#278;', "x97" => '&#243;', "x98" => '&#279;', "x99" => '&#244;', "x9A" => '&#246;', "x9B" => '&#245;', "x9C" => '&#250;', "x9D" => '&#282;', "x9E" => '&#283;', "x9F" => '&#252;', "xA0" => '&#8224;', "xA1" => '&#176;', "xA2" => '&#280;', "xA3" => '&#163;', "xA4" => '&#167;', "xA5" => '&#8226;', "xA6" => '&#182;', "xA7" => '&#223;', "xA8" => '&#174;', "xA9" => '&#169;', "xAA" => '&#8482;', "xAB" => '&#281;', "xAC" => '&#168;', "xAD" => '&#8800;', "xAE" => '&#291;', "xAF" => '&#302;', "xB0" => '&#303;', "xB1" => '&#298;', "xB2" => '&#8804;', "xB3" => '&#8805;', "xB4" => '&#299;', "xB5" => '&#310;', "xB6" => '&#8706;', "xB7" => '&#8721;', "xB8" => '&#322;', "xB9" => '&#315;', "xBA" => '&#316;', "xBB" => '&#317;', "xBC" => '&#318;', "xBD" => '&#313;', "xBE" => '&#314;', "xBF" => '&#325;', "xC0" => '&#326;', "xC1" => '&#323;', "xC2" => '&#172;', "xC3" => '&#8730;', "xC4" => '&#324;', "xC5" => '&#327;', "xC6" => '&#8710;', "xC7" => '&#171;', "xC8" => '&#187;', "xC9" => '&#8230;', "xCA" => '&#160;', "xCB" => '&#328;', "xCC" => '&#336;', "xCD" => '&#213;', "xCE" => '&#337;', "xCF" => '&#332;', "xD0" => '&#8211;', "xD1" => '&#8212;', "xD2" => '&#8220;', "xD3" => '&#8221;', "xD4" => '&#8216;', "xD5" => '&#8217;', "xD6" => '&#247;', "xD7" => '&#9674;', "xD8" => '&#333;', "xD9" => '&#340;', "xDA" => '&#341;', "xDB" => '&#344;', "xDC" => '&#8249;', "xDD" => '&#8250;', "xDE" => '&#345;', "xDF" => '&#342;', "xE0" => '&#343;', "xE1" => '&#352;', "xE2" => '&#8218;', "xE3" => '&#8222;', "xE4" => '&#353;', "xE5" => '&#346;', "xE6" => '&#347;', "xE7" => '&#193;', "xE8" => '&#356;', "xE9" => '&#357;', "xEA" => '&#205;', "xEB" => '&#381;', "xEC" => '&#382;', "xED" => '&#362;', "xEE" => '&#211;', "xEF" => '&#212;', "xF0" => '&#363;', "xF1" => '&#366;', "xF2" => '&#218;', "xF3" => '&#367;', "xF4" => '&#368;', "xF5" => '&#369;', "xF6" => '&#370;', "xF7" => '&#371;', "xF8" => '&#221;', "xF9" => '&#253;', "xFA" => '&#311;', "xFB" => '&#379;', "xFC" => '&#321;', "xFD" => '&#380;', "xFE" => '&#290;', "xFF" => '&#711;');
    $string = str_replace(array_keys($cp10029), array_values($cp10029), $string);
    return $string;
}
Exemple #21
0
/**
 * Decode cp1257-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1257($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1257')) {
        return $string;
    }
    $cp1257 = array("�" => '&#8364;', "�" => '&#8218;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#8240;', "�" => '&#8249;', "�" => '&#168;', "�" => '&#711;', "�" => '&#184;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#8482;', "�" => '&#8250;', "�" => '&#175;', "�" => '&#731;', "�" => '&#160;', "�" => '&#162;', "�" => '&#163;', "�" => '&#164;', "�" => '&#166;', "�" => '&#167;', "�" => '&#216;', "�" => '&#169;', "�" => '&#342;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#198;', "�" => '&#176;', "�" => '&#177;', "�" => '&#178;', "�" => '&#179;', "�" => '&#180;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#248;', "�" => '&#185;', "�" => '&#343;', "�" => '&#187;', "�" => '&#188;', "�" => '&#189;', "�" => '&#190;', "�" => '&#230;', "�" => '&#260;', "�" => '&#302;', "�" => '&#256;', "�" => '&#262;', "�" => '&#196;', "�" => '&#197;', "�" => '&#280;', "�" => '&#274;', "�" => '&#268;', "�" => '&#201;', "�" => '&#377;', "�" => '&#278;', "�" => '&#290;', "�" => '&#310;', "�" => '&#298;', "�" => '&#315;', "�" => '&#352;', "�" => '&#323;', "�" => '&#325;', "�" => '&#211;', "�" => '&#332;', "�" => '&#213;', "�" => '&#214;', "�" => '&#215;', "�" => '&#370;', "�" => '&#321;', "�" => '&#346;', "�" => '&#362;', "�" => '&#220;', "�" => '&#379;', "�" => '&#381;', "�" => '&#223;', "�" => '&#261;', "�" => '&#303;', "�" => '&#257;', "�" => '&#263;', "�" => '&#228;', "�" => '&#229;', "�" => '&#281;', "�" => '&#275;', "�" => '&#269;', "�" => '&#233;', "�" => '&#378;', "�" => '&#279;', "�" => '&#291;', "�" => '&#311;', "�" => '&#299;', "�" => '&#316;', "�" => '&#353;', "�" => '&#324;', "�" => '&#326;', "�" => '&#243;', "�" => '&#333;', "�" => '&#245;', "�" => '&#246;', "�" => '&#247;', "�" => '&#371;', "�" => '&#322;', "�" => '&#347;', "�" => '&#363;', "�" => '&#252;', "�" => '&#380;', "�" => '&#382;', "�" => '&#729;');
    $string = str_replace(array_keys($cp1257), array_values($cp1257), $string);
    return $string;
}
Exemple #22
0
/**
 * decode cp1256-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1256($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1256')) {
        return $string;
    }
    $cp1256 = array("�" => '&#8364;', "�" => '&#1662;', "�" => '&#8218;', "�" => '&#402;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#710;', "�" => '&#8240;', "�" => '&#1657;', "�" => '&#8249;', "�" => '&#338;', "�" => '&#1670;', "�" => '&#1688;', "�" => '&#1672;', "�" => '&#1711;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#1705;', "�" => '&#8482;', "�" => '&#1681;', "�" => '&#8250;', "�" => '&#339;', "�" => '&#8204;', "�" => '&#8205;', "�" => '&#1722;', "�" => '&#160;', "�" => '&#1548;', "�" => '&#162;', "�" => '&#163;', "�" => '&#164;', "�" => '&#165;', "�" => '&#166;', "�" => '&#167;', "�" => '&#168;', "�" => '&#169;', "�" => '&#1726;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#175;', "�" => '&#176;', "�" => '&#177;', "�" => '&#178;', "�" => '&#179;', "�" => '&#180;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#184;', "�" => '&#185;', "�" => '&#1563;', "�" => '&#187;', "�" => '&#188;', "�" => '&#189;', "�" => '&#190;', "�" => '&#1567;', "�" => '&#1729;', "�" => '&#1569;', "�" => '&#1570;', "�" => '&#1571;', "�" => '&#1572;', "�" => '&#1573;', "�" => '&#1574;', "�" => '&#1575;', "�" => '&#1576;', "�" => '&#1577;', "�" => '&#1578;', "�" => '&#1579;', "�" => '&#1580;', "�" => '&#1581;', "�" => '&#1582;', "�" => '&#1583;', "�" => '&#1584;', "�" => '&#1585;', "�" => '&#1586;', "�" => '&#1587;', "�" => '&#1588;', "�" => '&#1589;', "�" => '&#1590;', "�" => '&#215;', "�" => '&#1591;', "�" => '&#1592;', "�" => '&#1593;', "�" => '&#1594;', "�" => '&#1600;', "�" => '&#1601;', "�" => '&#1602;', "�" => '&#1603;', "�" => '&#224;', "�" => '&#1604;', "�" => '&#226;', "�" => '&#1605;', "�" => '&#1606;', "�" => '&#1607;', "�" => '&#1608;', "�" => '&#231;', "�" => '&#232;', "�" => '&#233;', "�" => '&#234;', "�" => '&#235;', "�" => '&#1609;', "�" => '&#1610;', "�" => '&#238;', "�" => '&#239;', "�" => '&#1611;', "�" => '&#1612;', "�" => '&#1613;', "�" => '&#1614;', "�" => '&#244;', "�" => '&#1615;', "�" => '&#1616;', "�" => '&#247;', "�" => '&#1617;', "�" => '&#249;', "�" => '&#1618;', "�" => '&#251;', "�" => '&#252;', "�" => '&#8206;', "�" => '&#8207;', "�" => '&#1746;');
    $string = str_replace(array_keys($cp1256), array_values($cp1256), $string);
    return $string;
}
Exemple #23
0
/**
 * Decode koi8r strings
 * @param string $string Encoded string
 * @return string Decoded string
 */
function charset_decode_koi8_r($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'koi8-r')) {
        return $string;
    }
    $koi8r = array("�" => '&#9472;', "�" => '&#9474;', "�" => '&#9484;', "�" => '&#9488;', "�" => '&#9492;', "�" => '&#9496;', "�" => '&#9500;', "�" => '&#9508;', "�" => '&#9516;', "�" => '&#9524;', "�" => '&#9532;', "�" => '&#9600;', "�" => '&#9604;', "�" => '&#9608;', "�" => '&#9612;', "�" => '&#9616;', "�" => '&#9617;', "�" => '&#9618;', "�" => '&#9619;', "�" => '&#8992;', "�" => '&#9632;', "�" => '&#8729;', "�" => '&#8730;', "�" => '&#8776;', "�" => '&#8804;', "�" => '&#8805;', "�" => '&#160;', "�" => '&#8993;', "�" => '&#176;', "�" => '&#178;', "�" => '&#183;', "�" => '&#247;', "�" => '&#9552;', "�" => '&#9553;', "�" => '&#9554;', "�" => '&#1105;', "�" => '&#9555;', "�" => '&#9556;', "�" => '&#9557;', "�" => '&#9558;', "�" => '&#9559;', "�" => '&#9560;', "�" => '&#9561;', "�" => '&#9562;', "�" => '&#9563;', "�" => '&#9564;', "�" => '&#9565;', "�" => '&#9566;', "�" => '&#9567;', "�" => '&#9568;', "�" => '&#9569;', "�" => '&#1025;', "�" => '&#9570;', "�" => '&#9571;', "�" => '&#9572;', "�" => '&#9573;', "�" => '&#9574;', "�" => '&#9575;', "�" => '&#9576;', "�" => '&#9577;', "�" => '&#9578;', "�" => '&#9579;', "�" => '&#9580;', "�" => '&#169;', "�" => '&#1102;', "�" => '&#1072;', "�" => '&#1073;', "�" => '&#1094;', "�" => '&#1076;', "�" => '&#1077;', "�" => '&#1092;', "�" => '&#1075;', "�" => '&#1093;', "�" => '&#1080;', "�" => '&#1081;', "�" => '&#1082;', "�" => '&#1083;', "�" => '&#1084;', "�" => '&#1085;', "�" => '&#1086;', "�" => '&#1087;', "�" => '&#1103;', "�" => '&#1088;', "�" => '&#1089;', "�" => '&#1090;', "�" => '&#1091;', "�" => '&#1078;', "�" => '&#1074;', "�" => '&#1100;', "�" => '&#1099;', "�" => '&#1079;', "�" => '&#1096;', "�" => '&#1101;', "�" => '&#1097;', "�" => '&#1095;', "�" => '&#1098;', "�" => '&#1070;', "�" => '&#1040;', "�" => '&#1041;', "�" => '&#1062;', "�" => '&#1044;', "�" => '&#1045;', "�" => '&#1060;', "�" => '&#1043;', "�" => '&#1061;', "�" => '&#1048;', "�" => '&#1049;', "�" => '&#1050;', "�" => '&#1051;', "�" => '&#1052;', "�" => '&#1053;', "�" => '&#1054;', "�" => '&#1055;', "�" => '&#1071;', "�" => '&#1056;', "�" => '&#1057;', "�" => '&#1058;', "�" => '&#1059;', "�" => '&#1046;', "�" => '&#1042;', "�" => '&#1068;', "�" => '&#1067;', "�" => '&#1047;', "�" => '&#1064;', "�" => '&#1069;', "�" => '&#1065;', "�" => '&#1063;', "�" => '&#1066;');
    $string = str_replace(array_keys($koi8r), array_values($koi8r), $string);
    return $string;
}
Exemple #24
0
/**
 * Decode a cp1250 string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1250($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1250')) {
        return $string;
    }
    $cp1250 = array("�" => '&#8364;', "�" => '&#65533;', "�" => '&#8218;', "�" => '&#65533;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#65533;', "�" => '&#8240;', "�" => '&#352;', "�" => '&#8249;', "�" => '&#346;', "�" => '&#356;', "�" => '&#381;', "�" => '&#377;', "�" => '&#65533;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#65533;', "�" => '&#8482;', "�" => '&#353;', "�" => '&#8250;', "�" => '&#347;', "�" => '&#357;', "�" => '&#382;', "�" => '&#378;', "�" => '&#160;', "�" => '&#711;', "�" => '&#728;', "�" => '&#321;', "�" => '&#164;', "�" => '&#260;', "�" => '&#166;', "�" => '&#167;', "�" => '&#168;', "�" => '&#169;', "�" => '&#350;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#379;', "�" => '&#176;', "�" => '&#177;', "�" => '&#731;', "�" => '&#322;', "�" => '&#180;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#184;', "�" => '&#261;', "�" => '&#351;', "�" => '&#187;', "�" => '&#317;', "�" => '&#733;', "�" => '&#318;', "�" => '&#380;', "�" => '&#340;', "�" => '&#193;', "�" => '&#194;', "�" => '&#258;', "�" => '&#196;', "�" => '&#313;', "�" => '&#262;', "�" => '&#199;', "�" => '&#268;', "�" => '&#201;', "�" => '&#280;', "�" => '&#203;', "�" => '&#282;', "�" => '&#205;', "�" => '&#206;', "�" => '&#270;', "�" => '&#272;', "�" => '&#323;', "�" => '&#327;', "�" => '&#211;', "�" => '&#212;', "�" => '&#336;', "�" => '&#214;', "�" => '&#215;', "�" => '&#344;', "�" => '&#366;', "�" => '&#218;', "�" => '&#368;', "�" => '&#220;', "�" => '&#221;', "�" => '&#354;', "�" => '&#223;', "�" => '&#341;', "�" => '&#225;', "�" => '&#226;', "�" => '&#259;', "�" => '&#228;', "�" => '&#314;', "�" => '&#263;', "�" => '&#231;', "�" => '&#269;', "�" => '&#233;', "�" => '&#281;', "�" => '&#235;', "�" => '&#283;', "�" => '&#237;', "�" => '&#238;', "�" => '&#271;', "�" => '&#273;', "�" => '&#324;', "�" => '&#328;', "�" => '&#243;', "�" => '&#244;', "�" => '&#337;', "�" => '&#246;', "�" => '&#247;', "�" => '&#345;', "�" => '&#367;', "�" => '&#250;', "�" => '&#369;', "�" => '&#252;', "�" => '&#253;', "�" => '&#355;', "�" => '&#729;');
    $string = str_replace(array_keys($cp1250), array_values($cp1250), $string);
    return $string;
}
Exemple #25
0
/**
 * Decode iso8859-1 string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_1($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-1')) {
        return $string;
    }
    $string = preg_replace("/([�-�])/e", "'&#' . ord('\\1') . ';'", $string);
    /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
    $string = str_replace("�", '&#160;', $string);
    $string = preg_replace("/([�-�])/e", "'&#' . ord('\\1') . ';'", $string);
    return $string;
}
Exemple #26
0
/**
 * us-ascii decoding function.
 *
 * @param string $string string that has to be cleaned
 * @return string cleaned string
 */
function charset_decode_us_ascii($string)
{
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'us-ascii')) {
        return $string;
    }
    $string = preg_replace("/([�-�])/e", "'?'", $string);
    /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
    $string = str_replace("�", '?', $string);
    $string = preg_replace("/([�-�])/e", "'?'", $string);
    return $string;
}
/**
 * Decode iso8859-16 string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_16($string)
{
    global $default_charset;
    if (strtolower($default_charset) == 'iso-8859-16') {
        return $string;
    }
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-16')) {
        return $string;
    }
    $iso8869_16 = array(" " => '&#160;', "¡" => '&#260;', "¢" => '&#261;', "£" => '&#321;', "¤" => '&#8364;', "¥" => '&#8222;', "¦" => '&#352;', "§" => '&#167;', "¨" => '&#353;', "©" => '&#169;', "ª" => '&#536;', "«" => '&#171;', "¬" => '&#377;', "­" => '&#173;', "®" => '&#378;', "¯" => '&#379;', "°" => '&#176;', "±" => '&#177;', "²" => '&#268;', "³" => '&#322;', "´" => '&#381;', "µ" => '&#8221;', "¶" => '&#182;', "·" => '&#183;', "¸" => '&#382;', "¹" => '&#269;', "º" => '&#537;', "»" => '&#187;', "¼" => '&#338;', "½" => '&#339;', "¾" => '&#376;', "¿" => '&#380;', "À" => '&#192;', "Á" => '&#193;', "Â" => '&#194;', "Ã" => '&#258;', "Ä" => '&#196;', "Å" => '&#262;', "Æ" => '&#198;', "Ç" => '&#199;', "È" => '&#200;', "É" => '&#201;', "Ê" => '&#202;', "Ë" => '&#203;', "Ì" => '&#204;', "Í" => '&#205;', "Î" => '&#206;', "Ï" => '&#207;', "Ð" => '&#272;', "Ñ" => '&#323;', "Ò" => '&#210;', "Ó" => '&#211;', "Ô" => '&#212;', "Õ" => '&#336;', "Ö" => '&#214;', "×" => '&#346;', "Ø" => '&#368;', "Ù" => '&#217;', "Ú" => '&#218;', "Û" => '&#219;', "Ü" => '&#220;', "Ý" => '&#280;', "Þ" => '&#538;', "ß" => '&#223;', "à" => '&#224;', "á" => '&#225;', "â" => '&#226;', "ã" => '&#259;', "ä" => '&#228;', "å" => '&#263;', "æ" => '&#230;', "ç" => '&#231;', "è" => '&#232;', "é" => '&#233;', "ê" => '&#234;', "ë" => '&#235;', "ì" => '&#236;', "í" => '&#237;', "î" => '&#238;', "ï" => '&#239;', "ð" => '&#273;', "ñ" => '&#324;', "ò" => '&#242;', "ó" => '&#243;', "ô" => '&#244;', "õ" => '&#337;', "ö" => '&#246;', "÷" => '&#347;', "ø" => '&#369;', "ù" => '&#249;', "ú" => '&#250;', "û" => '&#251;', "ü" => '&#252;', "ý" => '&#281;', "þ" => '&#539;', "ÿ" => '&#255;');
    $string = str_replace(array_keys($iso8859_16), array_values($iso8859_16), $string);
    return $string;
}
/**
 * Decode cp1254-encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_cp1254($string)
{
    global $default_charset;
    if (strtolower($default_charset) == 'windows-1254') {
        return $string;
    }
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'windows-1254')) {
        return $string;
    }
    $cp1254 = array("�" => '&#8364;', "�" => '&#65533;', "�" => '&#8218;', "�" => '&#402;', "�" => '&#8222;', "�" => '&#8230;', "�" => '&#8224;', "�" => '&#8225;', "�" => '&#710;', "�" => '&#8240;', "�" => '&#352;', "�" => '&#8249;', "�" => '&#338;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#8216;', "�" => '&#8217;', "�" => '&#8220;', "�" => '&#8221;', "�" => '&#8226;', "�" => '&#8211;', "�" => '&#8212;', "�" => '&#732;', "�" => '&#8482;', "�" => '&#353;', "�" => '&#8250;', "�" => '&#339;', "�" => '&#65533;', "�" => '&#65533;', "�" => '&#376;', "�" => '&#160;', "�" => '&#161;', "�" => '&#162;', "�" => '&#163;', "�" => '&#164;', "�" => '&#165;', "�" => '&#166;', "�" => '&#167;', "�" => '&#168;', "�" => '&#169;', "�" => '&#170;', "�" => '&#171;', "�" => '&#172;', "�" => '&#173;', "�" => '&#174;', "�" => '&#175;', "�" => '&#176;', "�" => '&#177;', "�" => '&#178;', "�" => '&#179;', "�" => '&#180;', "�" => '&#181;', "�" => '&#182;', "�" => '&#183;', "�" => '&#184;', "�" => '&#185;', "�" => '&#186;', "�" => '&#187;', "�" => '&#188;', "�" => '&#189;', "�" => '&#190;', "�" => '&#191;', "�" => '&#192;', "�" => '&#193;', "�" => '&#194;', "�" => '&#195;', "�" => '&#196;', "�" => '&#197;', "�" => '&#198;', "�" => '&#199;', "�" => '&#200;', "�" => '&#201;', "�" => '&#202;', "�" => '&#203;', "�" => '&#204;', "�" => '&#205;', "�" => '&#206;', "�" => '&#207;', "�" => '&#286;', "�" => '&#209;', "�" => '&#210;', "�" => '&#211;', "�" => '&#212;', "�" => '&#213;', "�" => '&#214;', "�" => '&#215;', "�" => '&#216;', "�" => '&#217;', "�" => '&#218;', "�" => '&#219;', "�" => '&#220;', "�" => '&#304;', "�" => '&#350;', "�" => '&#223;', "�" => '&#224;', "�" => '&#225;', "�" => '&#226;', "�" => '&#227;', "�" => '&#228;', "�" => '&#229;', "�" => '&#230;', "�" => '&#231;', "�" => '&#232;', "�" => '&#233;', "�" => '&#234;', "�" => '&#235;', "�" => '&#236;', "�" => '&#237;', "�" => '&#238;', "�" => '&#239;', "�" => '&#287;', "�" => '&#241;', "�" => '&#242;', "�" => '&#243;', "�" => '&#244;', "�" => '&#245;', "�" => '&#246;', "�" => '&#247;', "�" => '&#248;', "�" => '&#249;', "�" => '&#250;', "�" => '&#251;', "�" => '&#252;', "�" => '&#305;', "�" => '&#351;', "�" => '&#255;');
    $string = str_replace(array_keys($cp1254), array_values($cp1254), $string);
    return $string;
}
/**
 * Decode iso8859-4 string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_4($string)
{
    global $default_charset;
    if (strtolower($default_charset) == 'iso-8859-4') {
        return $string;
    }
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-4')) {
        return $string;
    }
    $iso8859_4 = array(" " => '&#160;', "¡" => '&#260;', "¢" => '&#312;', "£" => '&#342;', "¤" => '&#164;', "¥" => '&#296;', "¦" => '&#315;', "§" => '&#167;', "¨" => '&#168;', "©" => '&#352;', "ª" => '&#274;', "«" => '&#290;', "¬" => '&#358;', "­" => '&#173;', "®" => '&#381;', "¯" => '&#175;', "°" => '&#176;', "±" => '&#261;', "²" => '&#731;', "³" => '&#343;', "´" => '&#180;', "µ" => '&#297;', "¶" => '&#316;', "·" => '&#711;', "¸" => '&#184;', "¹" => '&#353;', "º" => '&#275;', "»" => '&#291;', "¼" => '&#359;', "½" => '&#330;', "¾" => '&#382;', "¿" => '&#331;', "À" => '&#256;', "Á" => '&#193;', "Â" => '&#194;', "Ã" => '&#195;', "Ä" => '&#196;', "Å" => '&#197;', "Æ" => '&#198;', "Ç" => '&#302;', "È" => '&#268;', "É" => '&#201;', "Ê" => '&#280;', "Ë" => '&#203;', "Ì" => '&#278;', "Í" => '&#205;', "Î" => '&#206;', "Ï" => '&#298;', "Ð" => '&#272;', "Ñ" => '&#325;', "Ò" => '&#332;', "Ó" => '&#310;', "Ô" => '&#212;', "Õ" => '&#213;', "Ö" => '&#214;', "×" => '&#215;', "Ø" => '&#216;', "Ù" => '&#370;', "Ú" => '&#218;', "Û" => '&#219;', "Ü" => '&#220;', "Ý" => '&#360;', "Þ" => '&#362;', "ß" => '&#223;', "à" => '&#257;', "á" => '&#225;', "â" => '&#226;', "ã" => '&#227;', "ä" => '&#228;', "å" => '&#229;', "æ" => '&#230;', "ç" => '&#303;', "è" => '&#269;', "é" => '&#233;', "ê" => '&#281;', "ë" => '&#235;', "ì" => '&#279;', "í" => '&#237;', "î" => '&#238;', "ï" => '&#299;', "ð" => '&#273;', "ñ" => '&#326;', "ò" => '&#333;', "ó" => '&#311;', "ô" => '&#244;', "õ" => '&#245;', "ö" => '&#246;', "÷" => '&#247;', "ø" => '&#248;', "ù" => '&#371;', "ú" => '&#250;', "û" => '&#251;', "ü" => '&#252;', "ý" => '&#361;', "þ" => '&#363;', "ÿ" => '&#729;');
    $string = str_replace(array_keys($iso8859_4), array_values($iso8859_4), $string);
    return $string;
}
/**
 * Decode iso8859-14 encoded string
 * @param string $string Encoded string
 * @return string $string Decoded string 
 */
function charset_decode_iso_8859_14($string)
{
    global $default_charset;
    if (strtolower($default_charset) == 'iso-8859-14') {
        return $string;
    }
    // don't do decoding when there are no 8bit symbols
    if (!sq_is8bit($string, 'iso-8859-14')) {
        return $string;
    }
    $iso8859_14 = array(" " => '&#160;', "¡" => '&#7682;', "¢" => '&#7683;', "£" => '&#163;', "¤" => '&#266;', "¥" => '&#267;', "¦" => '&#7690;', "§" => '&#167;', "¨" => '&#7808;', "©" => '&#169;', "ª" => '&#7810;', "«" => '&#7691;', "¬" => '&#7922;', "­" => '&#173;', "®" => '&#174;', "¯" => '&#376;', "°" => '&#7710;', "±" => '&#7711;', "²" => '&#288;', "³" => '&#289;', "´" => '&#7744;', "µ" => '&#7745;', "¶" => '&#182;', "·" => '&#7766;', "¸" => '&#7809;', "¹" => '&#7767;', "º" => '&#7811;', "»" => '&#7776;', "¼" => '&#7923;', "½" => '&#7812;', "¾" => '&#7813;', "¿" => '&#7777;', "À" => '&#192;', "Á" => '&#193;', "Â" => '&#194;', "Ã" => '&#195;', "Ä" => '&#196;', "Å" => '&#197;', "Æ" => '&#198;', "Ç" => '&#199;', "È" => '&#200;', "É" => '&#201;', "Ê" => '&#202;', "Ë" => '&#203;', "Ì" => '&#204;', "Í" => '&#205;', "Î" => '&#206;', "Ï" => '&#207;', "Ð" => '&#372;', "Ñ" => '&#209;', "Ò" => '&#210;', "Ó" => '&#211;', "Ô" => '&#212;', "Õ" => '&#213;', "Ö" => '&#214;', "×" => '&#7786;', "Ø" => '&#216;', "Ù" => '&#217;', "Ú" => '&#218;', "Û" => '&#219;', "Ü" => '&#220;', "Ý" => '&#221;', "Þ" => '&#374;', "ß" => '&#223;', "à" => '&#224;', "á" => '&#225;', "â" => '&#226;', "ã" => '&#227;', "ä" => '&#228;', "å" => '&#229;', "æ" => '&#230;', "ç" => '&#231;', "è" => '&#232;', "é" => '&#233;', "ê" => '&#234;', "ë" => '&#235;', "ì" => '&#236;', "í" => '&#237;', "î" => '&#238;', "ï" => '&#239;', "ð" => '&#373;', "ñ" => '&#241;', "ò" => '&#242;', "ó" => '&#243;', "ô" => '&#244;', "õ" => '&#245;', "ö" => '&#246;', "÷" => '&#7787;', "ø" => '&#248;', "ù" => '&#249;', "ú" => '&#250;', "û" => '&#251;', "ü" => '&#252;', "ý" => '&#253;', "þ" => '&#375;', "ÿ" => '&#255;');
    $string = str_replace(array_keys($iso8869_14), array_values($iso8859_14), $string);
    return $string;
}