phpDocumentor updates
[squirrelmail.git] / functions / decode / tis_620.php
1 <?php
2
3 /**
4 * decode/tis620.php
5 *
6 * This file contains tis620 decoding function that is needed to read
7 * tis620 encoded mails in non-tis620 locale.
8 *
9 * Original data taken from:
10 * http://www.inet.co.th/cyberclub/trin/thairef/tis620-iso10646.html
11 *
12 * Original copyright:
13 * Note: The information contained herein is provided as-is. It was
14 * complied from various references given at the end of the page.
15 * The author (trin@mozart.inet.co.th) believes all information
16 * presented here is accurate.
17 *
18 * References
19 * 1. [1]TIS 620-2533 Standard for Thai Character Codes for Computers
20 * (in Thai), [2]Thai Industrial Standards Institute
21 * 2. [3]Thai Information Technology Standards, On-line resources at the
22 * National Electronics and Computer Technology Center (NECTEC)
23 * 3. ISO/IEC 10646-1, [4]ISO/IEC JTC1/SC2
24 * 4. [5]Thai block in Unicode 2.1, [6]Unicode Consortium
25 *
26 * Links
27 * 1. http://www.nectec.or.th/it-standards/std620/std620.htm
28 * 2. http://www.tisi.go.th/
29 * 3. http://www.nectec.or.th/it-standards/
30 * 4. http://wwwold.dkuug.dk/JTC1/SC2/
31 * 5. http://charts.unicode.org/Unicode.charts/normal/U0E00.html
32 * 6. http://www.unicode.org/
33 *
34 * @copyright &copy; 2003-2005 The SquirrelMail Project Team
35 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
36 * @version $Id$
37 * @package squirrelmail
38 * @subpackage decode
39 */
40
41 /**
42 * Decode tis620 encoded strings
43 * @param string $string Encoded string
44 * @return string Decoded string
45 */
46 function charset_decode_tis_620 ($string) {
47 // don't do decoding when there are no 8bit symbols
48 if (! sq_is8bit($string,'tis-620'))
49 return $string;
50
51 $tis620 = array(
52 "\xA0" => '&#65535;',
53 "\xA1" => '&#3585;',
54 "\xA2" => '&#3586;',
55 "\xA3" => '&#3587;',
56 "\xA4" => '&#3588;',
57 "\xA5" => '&#3589;',
58 "\xA6" => '&#3590;',
59 "\xA7" => '&#3591;',
60 "\xA8" => '&#3592;',
61 "\xA9" => '&#3593;',
62 "\xAA" => '&#3594;',
63 "\xAB" => '&#3595;',
64 "\xAC" => '&#3596;',
65 "\xAD" => '&#3597;',
66 "\xAE" => '&#3598;',
67 "\xAF" => '&#3599;',
68 "\xB0" => '&#3600;',
69 "\xB1" => '&#3601;',
70 "\xB2" => '&#3602;',
71 "\xB3" => '&#3603;',
72 "\xB4" => '&#3604;',
73 "\xB5" => '&#3605;',
74 "\xB6" => '&#3606;',
75 "\xB7" => '&#3607;',
76 "\xB8" => '&#3608;',
77 "\xB9" => '&#3609;',
78 "\xBA" => '&#3610;',
79 "\xBB" => '&#3611;',
80 "\xBC" => '&#3612;',
81 "\xBD" => '&#3613;',
82 "\xBE" => '&#3614;',
83 "\xBF" => '&#3615;',
84 "\xC0" => '&#3616;',
85 "\xC1" => '&#3617;',
86 "\xC2" => '&#3618;',
87 "\xC3" => '&#3619;',
88 "\xC4" => '&#3620;',
89 "\xC5" => '&#3621;',
90 "\xC6" => '&#3622;',
91 "\xC7" => '&#3623;',
92 "\xC8" => '&#3624;',
93 "\xC9" => '&#3625;',
94 "\xCA" => '&#3626;',
95 "\xCB" => '&#3627;',
96 "\xCC" => '&#3628;',
97 "\xCD" => '&#3629;',
98 "\xCE" => '&#3630;',
99 "\xCF" => '&#3631;',
100 "\xD0" => '&#3632;',
101 "\xD1" => '&#3633;',
102 "\xD2" => '&#3634;',
103 "\xD3" => '&#3635;',
104 "\xD4" => '&#3636;',
105 "\xD5" => '&#3637;',
106 "\xD6" => '&#3638;',
107 "\xD7" => '&#3639;',
108 "\xD8" => '&#3640;',
109 "\xD9" => '&#3641;',
110 "\xDA" => '&#3642;',
111 "\xDB" => '&#65535;',
112 "\xDC" => '&#65535;',
113 "\xDD" => '&#65535;',
114 "\xDE" => '&#65535;',
115 "\xDF" => '&#3647;',
116 "\xE0" => '&#3648;',
117 "\xE1" => '&#3649;',
118 "\xE2" => '&#3650;',
119 "\xE3" => '&#3651;',
120 "\xE4" => '&#3652;',
121 "\xE5" => '&#3653;',
122 "\xE6" => '&#3654;',
123 "\xE7" => '&#3655;',
124 "\xE8" => '&#3656;',
125 "\xE9" => '&#3657;',
126 "\xEA" => '&#3658;',
127 "\xEB" => '&#3659;',
128 "\xEC" => '&#3660;',
129 "\xED" => '&#3661;',
130 "\xEE" => '&#3662;',
131 "\xEF" => '&#3663;',
132 "\xF0" => '&#3664;',
133 "\xF1" => '&#3665;',
134 "\xF2" => '&#3666;',
135 "\xF3" => '&#3667;',
136 "\xF4" => '&#3668;',
137 "\xF5" => '&#3669;',
138 "\xF6" => '&#3670;',
139 "\xF7" => '&#3671;',
140 "\xF8" => '&#3672;',
141 "\xF9" => '&#3673;',
142 "\xFA" => '&#3674;',
143 "\xFB" => '&#3675;',
144 "\xFC" => '&#65535;',
145 "\xFD" => '&#65535;',
146 "\xFE" => '&#65535;',
147 "\xFF" => '&#65535;'
148 );
149
150 $string = str_replace(array_keys($tis620), array_values($tis620), $string);
151
152 return $string;
153 }
154 ?>