cvs: pecl /translit/data diacritical_remove.c diacritical_remove.tr /translit/tests loop.phpt
| From: | Derick Rethans | Date: | Mon, 25 Oct 2004 07:37:53 +0000 |
| Subject: | cvs: pecl /translit/data diacritical_remove.c diacritical_remove.tr /translit/tests loop.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1981@lists.php.net to get a copy of this message | ||
derick Mon Oct 25 03:37:53 2004 EDT
Modified files:
/pecl/translit/data diacritical_remove.c diacritical_remove.tr
/pecl/translit/tests loop.phpt
Log:
- Complete the diacritical remove filter for Latin Extended-B
http://cvs.php.net/diff.php/pecl/translit/data/diacritical_remove.c?r1=1.3&r2=1.4&ty=u
Index: pecl/translit/data/diacritical_remove.c
diff -u pecl/translit/data/diacritical_remove.c:1.3 pecl/translit/data/diacritical_remove.c:1.4
--- pecl/translit/data/diacritical_remove.c:1.3 Sun Oct 24 17:35:04 2004
+++ pecl/translit/data/diacritical_remove.c Mon Oct 25 03:37:52 2004
@@ -37,7 +37,26 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+static unsigned char diacritical_remove_jump_map_2[256] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,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, 117, 85, 117, 85, 117, 0, 65, 97,
+ 65, 97, 198, 230, 71, 71, 103, 103, 75, 107, 81, 81, 113, 113, 487, 658,
+ 106, 0, 0, 0, 71, 103, 0, 0, 78, 110, 65, 97, 198, 230, 216, 248
+};
+
+static unsigned short diacritical_remove_replace_map_2[256] = {
+ 65, 65, 97, 97, 69, 69, 101, 101, 73, 73, 105, 105, 79, 79, 111, 111,
+ 82, 82, 114, 114, 85, 85, 117, 117, 83, 115, 84, 116, 0, 0, 72, 104,
+ 0, 0, 0, 0, 0, 0, 65, 97, 69, 101, 79, 111, 79, 111, 79, 111,
+ 79, 111, 89, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@@ -119,14 +157,16 @@
85, 117, 89, 121, 89, 121, 89, 121, 89, 121, 0, 0, 0, 0, 0, 0
};
-static unsigned char *jump_table[3] = {
+static unsigned char *jump_table[4] = {
diacritical_remove_jump_map_0,
diacritical_remove_jump_map_1,
+ diacritical_remove_jump_map_2,
diacritical_remove_jump_map_30,
};
-static unsigned short *map_table[3] = {
+static unsigned short *map_table[4] = {
diacritical_remove_replace_map_0,
diacritical_remove_replace_map_1,
+ diacritical_remove_replace_map_2,
diacritical_remove_replace_map_30,
};
static us0 *expand_table[0] = {
@@ -164,7 +204,8 @@
switch (block) {
case 0: jump_map = jump_table[0]; replace_map = map_table[0]; break;
case 1: jump_map = jump_table[1]; replace_map = map_table[1]; break;
- case 30: jump_map = jump_table[2]; replace_map = map_table[2]; break;
+ case 2: jump_map = jump_table[2]; replace_map = map_table[2]; break;
+ case 30: jump_map = jump_table[3]; replace_map = map_table[3]; break;
default: no_jump = 1;
}
if (no_jump) {
http://cvs.php.net/diff.php/pecl/translit/data/diacritical_remove.tr?r1=1.2&r2=1.3&ty=u
Index: pecl/translit/data/diacritical_remove.tr
diff -u pecl/translit/data/diacritical_remove.tr:1.2 pecl/translit/data/diacritical_remove.tr:1.3
--- pecl/translit/data/diacritical_remove.tr:1.2 Sun Oct 24 17:35:04 2004
+++ pecl/translit/data/diacritical_remove.tr Mon Oct 25 03:37:52 2004
@@ -64,10 +64,67 @@
U+0179,U+017B,U+017D = U+005A # Z
U+017A,U+017C,U+017E = U+007A # z
-# Latin Extended-B (incomplete)
+# Latin Extended-B
U+01C4 = U+01F1
U+01C5 = U+01F2
U+01C6 = U+01F3
+U+01CD = "A"
+U+01CE = "a"
+U+01CF = "I"
+U+01D0 = "i"
+U+01D1 = "O"
+U+01D2 = "o"
+Odd U+01D3-U+01DC = "U"
+Even U+01D3-U+01DC = "u"
+U+01DE,U+01E0 = "A"
+U+01DF,U+01E1 = "a"
+U+01E2 = U+00C6
+U+01E3 = U+00E6
+U+01E4,U+01E5 = "G"
+U+01E6,U+01E7 = "g"
+U+01E8 = "K"
+U+01E9 = "k"
+U+01EA,U+01EB = "Q"
+U+01EC,U+01ED = "q"
+U+01EE = U+01E7
+U+01EF = U+0292
+U+01F0 = "j"
+U+01F4 = "G"
+U+01F5 = "g"
+U+01F8 = "N"
+U+01F9 = "n"
+U+01FA = "A"
+U+01FB = "a"
+U+01FC = U+00C6
+U+01FD = U+00E6
+U+01FE = U+00D8
+U+01FF = U+00F8
+U+0200,U+0201 = "A"
+U+0202,U+0203 = "a"
+U+0204,U+0205 = "E"
+U+0206,U+0207 = "e"
+U+0208,U+0209 = "I"
+U+020A,U+020B = "i"
+U+020C,U+020D = "O"
+U+020E,U+020F = "o"
+U+0210,U+0211 = "R"
+U+0212,U+0213 = "r"
+U+0214,U+0215 = "U"
+U+0216,U+0217 = "u"
+U+0218 = "S"
+U+0219 = "s"
+U+021A = "T"
+U+021B = "t"
+U+021E = "H"
+U+021F = "h"
+U+0226 = "A"
+U+0227 = "a"
+U+0228 = "E"
+U+0229 = "e"
+Even U+022A-U+0231 = "O"
+Odd U+022A-U+0231 = "o"
+U+0232 = "Y"
+U+0233 = "y"
# Latin Extended Additional
U+1E00 = "A"
http://cvs.php.net/diff.php/pecl/translit/tests/loop.phpt?r1=1.1&r2=1.2&ty=u
Index: pecl/translit/tests/loop.phpt
diff -u pecl/translit/tests/loop.phpt:1.1 pecl/translit/tests/loop.phpt:1.2
--- pecl/translit/tests/loop.phpt:1.1 Sun Oct 24 11:13:26 2004
+++ pecl/translit/tests/loop.phpt Mon Oct 25 03:37:53 2004
@@ -1,5 +1,5 @@
<?php
$string = iconv("utf-8", "ucs-2",
file_get_contents('data/test-text.utf8'));
- $res = transliterate($string, array('normalize_ligature',
'diacritical_remove', 'normalize_punctuation',
'greek_transliterate'));
+ $res = transliterate($string, array('han_transliterate', 'diacritical_remove',
'normalize_punctuation', 'greek_transliterate'));
echo iconv('ucs-2', 'utf-8', $res);
?>