| Current Path : /proc/8644/task/8644/root/usr/share/squirrelmail/functions/decode/ | 
| Current File : //proc/8644/task/8644/root/usr/share/squirrelmail/functions/decode/iso_8859_7.php | 
<?php
/**
 * decode/iso8859-7.php
 *
 * This file contains iso-8859-7 decoding function that is needed to read
 * iso-8859-7 encoded mails in non-iso-8859-7 locale.
 *
 * Original data taken from:
 *  ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT
 *
 *   Name:             ISO 8859-7:1987 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_7.php 13893 2010-01-25 02:47:41Z pdontthink $
 * @package squirrelmail
 * @subpackage decode
 */
/**
 * 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(
        "\xA0" => ' ',
        "\xA1" => '‘',
        "\xA2" => '’',
        "\xA3" => '£',
        "\xA6" => '¦',
        "\xA7" => '§',
        "\xA8" => '¨',
        "\xA9" => '©',
        "\xAB" => '«',
        "\xAC" => '¬',
        "\xAD" => '­',
        "\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" => 'Ρ',
        "\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" => 'ώ'
    );
    $string = str_replace(array_keys($iso8859_7), array_values($iso8859_7), $string);
    return $string;
}