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 tis620 decoding function that is needed to read
10 * tis620 encoded mails in non-tis620 locale.
12 * Original data taken from:
13 * http://www.inet.co.th/cyberclub/trin/thairef/tis620-iso10646.html
16 * Note: The information contained herein is provided as-is. It was
17 * complied from various references given at the end of the page.
18 * The author (trin@mozart.inet.co.th) believes all information
19 * presented here is accurate.
22 * 1. [1]TIS 620-2533 Standard for Thai Character Codes for Computers
23 * (in Thai), [2]Thai Industrial Standards Institute
24 * 2. [3]Thai Information Technology Standards, On-line resources at the
25 * National Electronics and Computer Technology Center (NECTEC)
26 * 3. ISO/IEC 10646-1, [4]ISO/IEC JTC1/SC2
27 * 4. [5]Thai block in Unicode 2.1, [6]Unicode Consortium
30 * 1. http://www.nectec.or.th/it-standards/std620/std620.htm
31 * 2. http://www.tisi.go.th/
32 * 3. http://www.nectec.or.th/it-standards/
33 * 4. http://wwwold.dkuug.dk/JTC1/SC2/
34 * 5. http://charts.unicode.org/Unicode.charts/normal/U0E00.html
35 * 6. http://www.unicode.org/
37 * @package squirrelmail
42 * Decode tis620 encoded strings
43 * @param string $string Encoded string
44 * @return string Decoded string
46 function charset_decode_tis_620 ($string) {
47 global $default_charset;
49 if (strtolower($default_charset) == 'tis-620')
52 /* Only do the slow convert if there are 8-bit characters */
53 /* there is no 0x80-0x9F letters in TIS620 */
54 if ( ! ereg("[\241-\377]", $string) )
117 "\xDB" => '',
118 "\xDC" => '',
119 "\xDD" => '',
120 "\xDE" => '',
150 "\xFC" => '',
151 "\xFD" => '',
152 "\xFE" => '',
156 $string = str_replace(array_keys($tis620), array_values($tis620), $string);