5 * Copyright (c) 2003-2004 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * This file contains cp1257 decoding function that is needed to read
9 * cp1257 encoded mails in non-cp1257 locale.
11 * Original data taken from:
12 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1257.TXT
14 * Name: cp1257 to Unicode table
15 * Unicode version: 2.0
17 * Table format: Format A
19 * Contact: cpxlate@microsoft.com
22 * @package squirrelmail
27 * Decode cp1257-encoded string
28 * @param string $string Encoded string
29 * @return string $string Decoded string
31 function charset_decode_cp1257 ($string) {
32 global $default_charset;
34 if (strtolower($default_charset) == 'windows-1257')
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) )
161 $string = str_replace(array_keys($cp1257), array_values($cp1257), $string);