6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file contains iso-8859-1 decoding function that is needed to read
10 * iso-8859-1 encoded mails in non-iso-8859-1 locale.
13 function charset_decode_iso8859_1 ($string) {
14 global $default_charset;
16 if (strtolower($default_charset) == 'iso-8859-1')
19 /* Only do the slow convert if there are 8-bit characters */
20 /* there is no 0x80-0x9F letters in ISO8859-* */
21 if ( ! ereg("[\241-\377]", $string) )
24 $string = preg_replace("/([\201-\237])/e","'&#' . ord('\\1') . ';'",$string);
26 /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
27 $string = str_replace("\240", ' ', $string);
29 $string = preg_replace("/([\241-\377])/e","'&#' . ord('\\1') . ';'",$string);