123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <?php
- /**
- * decode/iso8859-3.php
- *
- * Copyright (c) 2003-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * This file contains iso-8859-3 decoding function that is needed to read
- * iso-8859-3 encoded mails in non-iso-8859-3 locale.
- *
- * Original data taken from:
- * ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT
- *
- * Name: ISO/IEC 8859-3:1999 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.
- *
- * @version $Id$
- * @package squirrelmail
- * @subpackage decode
- */
- /**
- * Decode iso8859-3 encoded string
- * @param string $string Encoded string
- * @return string $string Decoded string
- */
- function charset_decode_iso_8859_3 ($string) {
- global $default_charset;
- if (strtolower($default_charset) == 'iso-8859-3')
- return $string;
- /* Only do the slow convert if there are 8-bit characters */
- /* there is no 0x80-0x9F letters in ISO8859-* */
- if ( ! ereg("[\241-\377]", $string) )
- return $string;
- $iso8859_3 = array(
- "\xA0" => ' ',
- "\xA1" => 'Ħ',
- "\xA2" => '˘',
- "\xA3" => '£',
- "\xA4" => '¤',
- "\xA6" => 'Ĥ',
- "\xA7" => '§',
- "\xA8" => '¨',
- "\xA9" => 'İ',
- "\xAA" => 'Ş',
- "\xAB" => 'Ğ',
- "\xAC" => 'Ĵ',
- "\xAD" => '­',
- "\xAF" => 'Ż',
- "\xB0" => '°',
- "\xB1" => 'ħ',
- "\xB2" => '²',
- "\xB3" => '³',
- "\xB4" => '´',
- "\xB5" => 'µ',
- "\xB6" => 'ĥ',
- "\xB7" => '·',
- "\xB8" => '¸',
- "\xB9" => 'ı',
- "\xBA" => 'ş',
- "\xBB" => 'ğ',
- "\xBC" => 'ĵ',
- "\xBD" => '½',
- "\xBF" => 'ż',
- "\xC0" => 'À',
- "\xC1" => 'Á',
- "\xC2" => 'Â',
- "\xC4" => 'Ä',
- "\xC5" => 'Ċ',
- "\xC6" => 'Ĉ',
- "\xC7" => 'Ç',
- "\xC8" => 'È',
- "\xC9" => 'É',
- "\xCA" => 'Ê',
- "\xCB" => 'Ë',
- "\xCC" => 'Ì',
- "\xCD" => 'Í',
- "\xCE" => 'Î',
- "\xCF" => 'Ï',
- "\xD1" => 'Ñ',
- "\xD2" => 'Ò',
- "\xD3" => 'Ó',
- "\xD4" => 'Ô',
- "\xD5" => 'Ġ',
- "\xD6" => 'Ö',
- "\xD7" => '×',
- "\xD8" => 'Ĝ',
- "\xD9" => 'Ù',
- "\xDA" => 'Ú',
- "\xDB" => 'Û',
- "\xDC" => 'Ü',
- "\xDD" => 'Ŭ',
- "\xDE" => 'Ŝ',
- "\xDF" => 'ß',
- "\xE0" => 'à',
- "\xE1" => 'á',
- "\xE2" => 'â',
- "\xE4" => 'ä',
- "\xE5" => 'ċ',
- "\xE6" => 'ĉ',
- "\xE7" => 'ç',
- "\xE8" => 'è',
- "\xE9" => 'é',
- "\xEA" => 'ê',
- "\xEB" => 'ë',
- "\xEC" => 'ì',
- "\xED" => 'í',
- "\xEE" => 'î',
- "\xEF" => 'ï',
- "\xF1" => 'ñ',
- "\xF2" => 'ò',
- "\xF3" => 'ó',
- "\xF4" => 'ô',
- "\xF5" => 'ġ',
- "\xF6" => 'ö',
- "\xF7" => '÷',
- "\xF8" => 'ĝ',
- "\xF9" => 'ù',
- "\xFA" => 'ú',
- "\xFB" => 'û',
- "\xFC" => 'ü',
- "\xFD" => 'ŭ',
- "\xFE" => 'ŝ',
- "\xFF" => '˙'
- );
- $string = str_replace(array_keys($iso8859_3), array_values($iso8859_3), $string);
- return $string;
- }
- ?>
|