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