6 * Copyright (c) 2003-2004 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This file contains cp1252 decoding function that is needed to read
10 * cp1252 encoded mails in non-cp1252 locale.
12 * Original data taken from:
13 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
15 * Name: cp1252 to Unicode table
16 * Unicode version: 2.0
18 * Table format: Format A
20 * Contact: cpxlate@microsoft.com
21 * @package squirrelmail
26 * Decode cp1252-encoded string
27 * @param string $string Encoded string
28 * @return string $string Decoded string
31 function charset_decode_cp1252 ($string) {
32 global $default_charset;
34 if (strtolower($default_charset) == 'windows-1252')
37 /* Only do the slow convert if there are 8-bit characters */
38 /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */
39 if (! ereg("[\200-\237]", $string) and ! ereg("[\241-\377]", $string) )
173 $string = str_replace(array_keys($cp1252), array_values($cp1252), $string);