Mercurial > hg > extraction-interface
comparison config/Lib_mb_utf8.php @ 47:886f43b26ee2 extractapp
move/remove develop folder
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 17 Mar 2015 10:54:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
46:b3ca5d2b4d3f | 47:886f43b26ee2 |
---|---|
1 <?php | |
2 mb_regex_encoding('UTF-8'); | |
3 mb_internal_encoding('UTF-8'); | |
4 | |
5 // ****************************************************************************** | |
6 | |
7 function mb($s) { | |
8 return mb8($s); | |
9 } | |
10 | |
11 function mb16($s) { | |
12 //return mb_convert_encoding($s, 'UTF-16LE'); | |
13 return big5_to_utf16($s); | |
14 } | |
15 | |
16 function mb8($s) { | |
17 //return mb_convert_encoding($s, 'UTF-16LE'); | |
18 return big5_to_utf8($s); | |
19 } | |
20 | |
21 function u8b5($s) { | |
22 return utf8_to_big5($s); | |
23 } | |
24 | |
25 function b5u8($s) { | |
26 return big5_to_utf8($s); | |
27 } | |
28 | |
29 function u8u16($s) { | |
30 return utf8_to_utf16($s); | |
31 } | |
32 | |
33 function u16u8($s) { | |
34 return utf16_to_utf8($s); | |
35 } | |
36 | |
37 function b5u16($s) { | |
38 return big5_to_utf16($s); | |
39 } | |
40 | |
41 function u16b5($s) { | |
42 return utf16_to_big5($s); | |
43 } | |
44 | |
45 function big5_to_utf16($s) { | |
46 if (!$s) return ''; | |
47 return iconv("BIG-5", "UTF-16LE", $s); | |
48 } | |
49 | |
50 function utf16_to_big5($s) { | |
51 if (!$s) return ''; | |
52 return iconv("UTF-16LE", "BIG-5//IGNORE", $s); | |
53 } | |
54 | |
55 function utf16_to_utf8($s) { | |
56 if (!$s) return ''; | |
57 return iconv("UTF-16LE", "UTF-8", $s); | |
58 } | |
59 | |
60 function utf8_to_utf16($s) { | |
61 if (!$s) return ''; | |
62 return iconv("UTF-8", "UTF-16LE", $s); | |
63 } | |
64 | |
65 function big5_to_utf8($s) { | |
66 if (!$s) return ''; | |
67 return iconv("CP950", "UTF-8//IGNORE", $s); | |
68 } | |
69 | |
70 function utf8_to_big5($s) { | |
71 if (!$s) return ''; | |
72 return iconv("UTF-8", "CP950//IGNORE", $s); | |
73 } | |
74 | |
75 // ****************************************************************************** | |
76 ?> |