Annotation of embedaddon/php/ext/standard/tests/strings/html_entity_decode_win1252.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Translation of HTML entities for encoding WIN-1252
3: --FILE--
4: <?php
5: $arr = array(
6: 0x20AC => array(0x80, "EURO SIGN"),
7: //0x81 #UNDEFINED
8: 0x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"),
9: 0x0192 => array(0x83, "LATIN SMALL LETTER F WITH HOOK"),
10: 0x201E => array(0x84, "DOUBLE LOW-9 QUOTATION MARK"),
11: 0x2026 => array(0x85, "HORIZONTAL ELLIPSIS"),
12: 0x2020 => array(0x86, "DAGGER"),
13: 0x2021 => array(0x87, "DOUBLE DAGGER"),
14: 0x02C6 => array(0x88, "MODIFIER LETTER CIRCUMFLEX ACCENT"),
15: 0x2030 => array(0x89, "PER MILLE SIGN"),
16: 0x0160 => array(0x8A, "LATIN CAPITAL LETTER S WITH CARON"),
17: 0x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
18: 0x0152 => array(0x8C, "LATIN CAPITAL LIGATURE OE"),
19: //0x8D #UNDEFINED
20: 0x017D => array(0x8E, "LATIN CAPITAL LETTER Z WITH CARON"),
21: //0x8F #UNDEFINED
22: //0x90 #UNDEFINED
23: 0x2018 => array(0x91, "LEFT SINGLE QUOTATION MARK"),
24: 0x2019 => array(0x92, "RIGHT SINGLE QUOTATION MARK"),
25: 0x201C => array(0x93, "LEFT DOUBLE QUOTATION MARK"),
26: 0x201D => array(0x94, "RIGHT DOUBLE QUOTATION MARK"),
27: 0x2022 => array(0x95, "BULLET"),
28: 0x2013 => array(0x96, "EN DASH"),
29: 0x2014 => array(0x97, "EM DASH"),
30: 0x02DC => array(0x98, "SMALL TILDE"),
31: 0x2122 => array(0x99, "TRADE MARK SIGN"),
32: 0x0161 => array(0x9A, "LATIN SMALL LETTER S WITH CARON"),
33: 0x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
34: 0x0153 => array(0x9C, "LATIN SMALL LIGATURE OE"),
35: //0x9D #UNDEFINED
36: 0x017E => array(0x9E, "LATIN SMALL LETTER Z WITH CARON"),
37: 0x0178 => array(0x9F, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
38: );
39:
40: $res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252');
41: echo "Special test for  (shouldn't decode):\n";
42: echo $res,"\n\n";
43:
44: $res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252');
45: echo "Special test for  (shouldn't decode):\n";
46: echo $res,"\n\n";
47:
48: $res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252');
49: echo "Special test for  (shouldn't decode):\n";
50: echo $res,"\n\n";
51:
52: $res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252');
53: echo "Special test for  (shouldn't decode):\n";
54: echo $res,"\n\n";
55:
56: $res = html_entity_decode("", ENT_QUOTES, 'WINDOWS-1252');
57: echo "Special test for  (shouldn't decode):\n";
58: echo $res,"\n\n";
59:
60: foreach ($arr as $u => $v) {
61: $ent = sprintf("&#x%X;", $u);
62: $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252');
63: $d = unpack("H*", $res);
64: echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
65:
66: $ent = sprintf("&#x%X;", $v[0]);
67: $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252');
68: if ($res[0] != "&" || $res[1] != "#")
69: $res = unpack("H*", $res)[1];
70: echo sprintf("%s => %s\n\n", $ent, $res);
71: }
72: --EXPECT--
73: Special test for  (shouldn't decode):
74: 
75:
76: Special test for  (shouldn't decode):
77: 
78:
79: Special test for  (shouldn't decode):
80: 
81:
82: Special test for  (shouldn't decode):
83: 
84:
85: Special test for  (shouldn't decode):
86: 
87:
88: EURO SIGN: € => 80
89: € => €
90:
91: SINGLE LOW-9 QUOTATION MARK: ‚ => 82
92: ‚ => ‚
93:
94: LATIN SMALL LETTER F WITH HOOK: ƒ => 83
95: ƒ => ƒ
96:
97: DOUBLE LOW-9 QUOTATION MARK: „ => 84
98: „ => „
99:
100: HORIZONTAL ELLIPSIS: … => 85
101: … => …
102:
103: DAGGER: † => 86
104: † => †
105:
106: DOUBLE DAGGER: ‡ => 87
107: ‡ => ‡
108:
109: MODIFIER LETTER CIRCUMFLEX ACCENT: ˆ => 88
110: ˆ => ˆ
111:
112: PER MILLE SIGN: ‰ => 89
113: ‰ => ‰
114:
115: LATIN CAPITAL LETTER S WITH CARON: Š => 8a
116: Š => Š
117:
118: SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => 8b
119: ‹ => ‹
120:
121: LATIN CAPITAL LIGATURE OE: Œ => 8c
122: Œ => Œ
123:
124: LATIN CAPITAL LETTER Z WITH CARON: Ž => 8e
125: Ž => Ž
126:
127: LEFT SINGLE QUOTATION MARK: ‘ => 91
128: ‘ => ‘
129:
130: RIGHT SINGLE QUOTATION MARK: ’ => 92
131: ’ => ’
132:
133: LEFT DOUBLE QUOTATION MARK: “ => 93
134: “ => “
135:
136: RIGHT DOUBLE QUOTATION MARK: ” => 94
137: ” => ”
138:
139: BULLET: • => 95
140: • => •
141:
142: EN DASH: – => 96
143: – => –
144:
145: EM DASH: — => 97
146: — => —
147:
148: SMALL TILDE: ˜ => 98
149: ˜ => ˜
150:
151: TRADE MARK SIGN: ™ => 99
152: ™ => ™
153:
154: LATIN SMALL LETTER S WITH CARON: š => 9a
155: š => š
156:
157: SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => 9b
158: › => ›
159:
160: LATIN SMALL LIGATURE OE: œ => 9c
161: œ => œ
162:
163: LATIN SMALL LETTER Z WITH CARON: ž => 9e
164: ž => ž
165:
166: LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => 9f
167: Ÿ => Ÿ
168:
169:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>