<?php
+
/**
* decode/iso8859-13.php
- * $Id$
- *
- * Copyright (c) 2003 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This file contains iso-8859-13 decoding function that is needed to read
* iso-8859-13 encoded mails in non-iso-8859-13 locale.
- *
+ *
* Original data taken from:
* ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-13.TXT
*
* Authors: Ken Whistler <kenw@sybase.com>
*
* Original copyright:
- * Copyright (c) 1999 Unicode, Inc. All Rights reserved.
+ * 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.
*
- * 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.
*
- * 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-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
* @package squirrelmail
* @subpackage decode
*/
* @return string $string Decoded string
*/
function charset_decode_iso_8859_13 ($string) {
- global $default_charset;
-
- if (strtolower($default_charset) == 'iso-8859-13')
- 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) )
+ // don't do decoding when there are no 8bit symbols
+ if (! sq_is8bit($string,'iso-8859-13'))
return $string;
$iso8859_13 = 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" => '’'
+ "\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_13), array_values($iso8859_13), $string);
return $string;
}
-
-?>