| Current Path : /proc/8644/root/proc/self/root/usr/share/squirrelmail/functions/decode/ | 
| Current File : //proc/8644/root/proc/self/root/usr/share/squirrelmail/functions/decode/iso_8859_4.php | 
<?php
/**
 * decode/iso8859-4.php
 *
 * This file contains iso-8859-4 decoding function that is needed to read
 * iso-8859-4 encoded mails in non-iso-8859-4 locale.
 *
 * Original data taken from:
 *  ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-4.TXT
 *
 *   Name:             ISO/IEC 8859-4:1998 to Unicode
 *   Unicode version:  3.0
 *   Table version:    1.0
 *   Table format:     Format A
 *   Date:             1999 July 27
 *   Authors:          Ken Whistler <kenw@sybase.com>
 *
 * Original copyright:
 *  Copyright (c) 1999 Unicode, Inc.  All Rights reserved.
 *
 *  This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
 *  No claims are made as to fitness for any particular purpose.  No
 *  warranties of any kind are expressed or implied.  The recipient
 *  agrees to determine applicability of information provided.  If this
 *  file has been provided on optical media by Unicode, Inc., the sole
 *  remedy for any claim will be exchange of defective media within 90
 *  days of receipt.
 *
 *  Unicode, Inc. hereby grants the right to freely use the information
 *  supplied in this file in the creation of products supporting the
 *  Unicode Standard, and to make copies of this file in any form for
 *  internal or external distribution as long as this notice remains
 *  attached.
 *
 * @copyright 2003-2010 The SquirrelMail Project Team
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version $Id: iso_8859_4.php 13893 2010-01-25 02:47:41Z pdontthink $
 * @package squirrelmail
 * @subpackage decode
 */
/**
 * Decode iso8859-4 string
 * @param string $string Encoded string
 * @return string $string Decoded string
 */
function charset_decode_iso_8859_4 ($string) {
    // don't do decoding when there are no 8bit symbols
    if (! sq_is8bit($string,'iso-8859-4'))
        return $string;
    $iso8859_4 = array(
        "\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($iso8859_4), array_values($iso8859_4), $string);
    return $string;
}