7c1923141ce804faa52a21031a2890fa53452cd2
6 * This file contains iso-8859-1 decoding function that is needed to read
7 * iso-8859-1 encoded mails in non-iso-8859-1 locale.
9 * @copyright 2003-2009 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @package squirrelmail
17 * Decode iso8859-1 string
18 * @param string $string Encoded string
19 * @return string $string Decoded string
21 function charset_decode_iso_8859_1 ($string) {
22 // don't do decoding when there are no 8bit symbols
23 if (! sq_is8bit($string,'iso-8859-1'))
26 $string = preg_replace("/([\201-\237])/e","'&#' . ord('\\1') . ';'",$string);
28 /* I don't want to use 0xA0 (\240) in any ranges. RH73 may dislike it */
29 $string = str_replace("\240", ' ', $string);
31 $string = preg_replace("/([\241-\377])/e","'&#' . ord('\\1') . ';'",$string);