| Current Path : /proc/8644/task/8644/root/usr/share/squirrelmail/functions/decode/ | 
| Current File : //proc/8644/task/8644/root/usr/share/squirrelmail/functions/decode/cp1255.php | 
<?php
/**
 * decode/cp1255.php
 *
 * 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
 *
 * @copyright 2003-2010 The SquirrelMail Project Team
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version $Id: cp1255.php 13893 2010-01-25 02:47:41Z pdontthink $
 * @package squirrelmail
 * @subpackage decode
 */
/**
 * 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(
        "\x80" => '€',
        "\x81" => '�',
        "\x82" => '‚',
        "\x83" => 'ƒ',
        "\x84" => '„',
        "\x85" => '…',
        "\x86" => '†',
        "\x87" => '‡',
        "\x88" => 'ˆ',
        "\x89" => '‰',
        "\x8A" => '�',
        "\x8B" => '‹',
        "\x8C" => '�',
        "\x8D" => '�',
        "\x8E" => '�',
        "\x8F" => '�',
        "\x90" => '�',
        "\x91" => '‘',
        "\x92" => '’',
        "\x93" => '“',
        "\x94" => '”',
        "\x95" => '•',
        "\x96" => '–',
        "\x97" => '—',
        "\x98" => '˜',
        "\x99" => '™',
        "\x9A" => '�',
        "\x9B" => '›',
        "\x9C" => '�',
        "\x9D" => '�',
        "\x9E" => '�',
        "\x9F" => '�',
        "\xA0" => ' ',
        "\xA1" => '¡',
        "\xA2" => '¢',
        "\xA3" => '£',
        "\xA4" => '₪',
        "\xA5" => '¥',
        "\xA6" => '¦',
        "\xA7" => '§',
        "\xA8" => '¨',
        "\xA9" => '©',
        "\xAA" => '×',
        "\xAB" => '«',
        "\xAC" => '¬',
        "\xAD" => '­',
        "\xAE" => '®',
        "\xAF" => '¯',
        "\xB0" => '°',
        "\xB1" => '±',
        "\xB2" => '²',
        "\xB3" => '³',
        "\xB4" => '´',
        "\xB5" => 'µ',
        "\xB6" => '¶',
        "\xB7" => '·',
        "\xB8" => '¸',
        "\xB9" => '¹',
        "\xBA" => '÷',
        "\xBB" => '»',
        "\xBC" => '¼',
        "\xBD" => '½',
        "\xBE" => '¾',
        "\xBF" => '¿',
        "\xC0" => 'ְ',
        "\xC1" => 'ֱ',
        "\xC2" => 'ֲ',
        "\xC3" => 'ֳ',
        "\xC4" => 'ִ',
        "\xC5" => 'ֵ',
        "\xC6" => 'ֶ',
        "\xC7" => 'ַ',
        "\xC8" => 'ָ',
        "\xC9" => 'ֹ',
        "\xCA" => '�',
        "\xCB" => 'ֻ',
        "\xCC" => 'ּ',
        "\xCD" => 'ֽ',
        "\xCE" => '־',
        "\xCF" => 'ֿ',
        "\xD0" => '׀',
        "\xD1" => 'ׁ',
        "\xD2" => 'ׂ',
        "\xD3" => '׃',
        "\xD4" => 'װ',
        "\xD5" => 'ױ',
        "\xD6" => 'ײ',
        "\xD7" => '׳',
        "\xD8" => '״',
        "\xD9" => '�',
        "\xDA" => '�',
        "\xDB" => '�',
        "\xDC" => '�',
        "\xDD" => '�',
        "\xDE" => '�',
        "\xDF" => '�',
        "\xE0" => 'א',
        "\xE1" => 'ב',
        "\xE2" => 'ג',
        "\xE3" => 'ד',
        "\xE4" => 'ה',
        "\xE5" => 'ו',
        "\xE6" => 'ז',
        "\xE7" => 'ח',
        "\xE8" => 'ט',
        "\xE9" => 'י',
        "\xEA" => 'ך',
        "\xEB" => 'כ',
        "\xEC" => 'ל',
        "\xED" => 'ם',
        "\xEE" => 'מ',
        "\xEF" => 'ן',
        "\xF0" => 'נ',
        "\xF1" => 'ס',
        "\xF2" => 'ע',
        "\xF3" => 'ף',
        "\xF4" => 'פ',
        "\xF5" => 'ץ',
        "\xF6" => 'צ',
        "\xF7" => 'ק',
        "\xF8" => 'ר',
        "\xF9" => 'ש',
        "\xFA" => 'ת',
        "\xFB" => '�',
        "\xFC" => '�',
        "\xFD" => '‎',
        "\xFE" => '‏',
        "\xFF" => '�'
    );
    $string = str_replace(array_keys($cp1255), array_values($cp1255), $string);
    return $string;
}