Annotation of embedaddon/php/ext/standard/tests/strings/htmlentities_html4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: htmlentities() conformance check (HTML 4)
3: --FILE--
4: <?php
5: function utf32_utf8($k) {
6: if ($k < 0x80) {
7: $retval = pack('C', $k);
8: } else if ($k < 0x800) {
9: $retval = pack('C2',
10: 0xc0 | ($k >> 6),
11: 0x80 | ($k & 0x3f));
12: } else if ($k < 0x10000) {
13: $retval = pack('C3',
14: 0xe0 | ($k >> 12),
15: 0x80 | (($k >> 6) & 0x3f),
16: 0x80 | ($k & 0x3f));
17: } else if ($k < 0x200000) {
18: $retval = pack('C4',
19: 0xf0 | ($k >> 18),
20: 0x80 | (($k >> 12) & 0x3f),
21: 0x80 | (($k >> 6) & 0x3f),
22: 0x80 | ($k & 0x3f));
23: } else if ($k < 0x4000000) {
24: $retval = pack('C5',
25: 0xf8 | ($k >> 24),
26: 0x80 | (($k >> 18) & 0x3f),
27: 0x80 | (($k >> 12) & 0x3f),
28: 0x80 | (($k >> 6) & 0x3f),
29: 0x80 | ($k & 0x3f));
30: } else {
31: $retval = pack('C6',
32: 0xfc | ($k >> 30),
33: 0x80 | (($k >> 24) & 0x3f),
34: 0x80 | (($k >> 18) & 0x3f),
35: 0x80 | (($k >> 12) & 0x3f),
36: 0x80 | (($k >> 6) & 0x3f),
37: 0x80 | ($k & 0x3f));
38: }
39: return $retval;
40: }
41:
42: $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, 'UTF-8');
43:
44: for ($i = 0; $i < 0x2710; $i++) {
45: if ($i >= 0xd800 && $i < 0xe000)
46: continue;
47: $str = utf32_utf8($i);
48: if (isset($table[$str])) {
49: printf("%s\tU+%05X\n", $table[$str], $i);
50: unset($table[$str]);
51: }
52: }
53:
54: if (!empty($table)) {
55: echo "Not matched entities: ";
56: var_dump($table);
57: }
58:
59: ?>
60: --EXPECT--
61: " U+00022
62: & U+00026
63: ' U+00027
64: < U+0003C
65: > U+0003E
66: U+000A0
67: ¡ U+000A1
68: ¢ U+000A2
69: £ U+000A3
70: ¤ U+000A4
71: ¥ U+000A5
72: ¦ U+000A6
73: § U+000A7
74: ¨ U+000A8
75: © U+000A9
76: ª U+000AA
77: « U+000AB
78: ¬ U+000AC
79: ­ U+000AD
80: ® U+000AE
81: ¯ U+000AF
82: ° U+000B0
83: ± U+000B1
84: ² U+000B2
85: ³ U+000B3
86: ´ U+000B4
87: µ U+000B5
88: ¶ U+000B6
89: · U+000B7
90: ¸ U+000B8
91: ¹ U+000B9
92: º U+000BA
93: » U+000BB
94: ¼ U+000BC
95: ½ U+000BD
96: ¾ U+000BE
97: ¿ U+000BF
98: À U+000C0
99: Á U+000C1
100: Â U+000C2
101: Ã U+000C3
102: Ä U+000C4
103: Å U+000C5
104: Æ U+000C6
105: Ç U+000C7
106: È U+000C8
107: É U+000C9
108: Ê U+000CA
109: Ë U+000CB
110: Ì U+000CC
111: Í U+000CD
112: Î U+000CE
113: Ï U+000CF
114: Ð U+000D0
115: Ñ U+000D1
116: Ò U+000D2
117: Ó U+000D3
118: Ô U+000D4
119: Õ U+000D5
120: Ö U+000D6
121: × U+000D7
122: Ø U+000D8
123: Ù U+000D9
124: Ú U+000DA
125: Û U+000DB
126: Ü U+000DC
127: Ý U+000DD
128: Þ U+000DE
129: ß U+000DF
130: à U+000E0
131: á U+000E1
132: â U+000E2
133: ã U+000E3
134: ä U+000E4
135: å U+000E5
136: æ U+000E6
137: ç U+000E7
138: è U+000E8
139: é U+000E9
140: ê U+000EA
141: ë U+000EB
142: ì U+000EC
143: í U+000ED
144: î U+000EE
145: ï U+000EF
146: ð U+000F0
147: ñ U+000F1
148: ò U+000F2
149: ó U+000F3
150: ô U+000F4
151: õ U+000F5
152: ö U+000F6
153: ÷ U+000F7
154: ø U+000F8
155: ù U+000F9
156: ú U+000FA
157: û U+000FB
158: ü U+000FC
159: ý U+000FD
160: þ U+000FE
161: ÿ U+000FF
162: Œ U+00152
163: œ U+00153
164: Š U+00160
165: š U+00161
166: Ÿ U+00178
167: ƒ U+00192
168: ˆ U+002C6
169: ˜ U+002DC
170: Α U+00391
171: Β U+00392
172: Γ U+00393
173: Δ U+00394
174: Ε U+00395
175: Ζ U+00396
176: Η U+00397
177: Θ U+00398
178: Ι U+00399
179: Κ U+0039A
180: Λ U+0039B
181: Μ U+0039C
182: Ν U+0039D
183: Ξ U+0039E
184: Ο U+0039F
185: Π U+003A0
186: Ρ U+003A1
187: Σ U+003A3
188: Τ U+003A4
189: Υ U+003A5
190: Φ U+003A6
191: Χ U+003A7
192: Ψ U+003A8
193: Ω U+003A9
194: α U+003B1
195: β U+003B2
196: γ U+003B3
197: δ U+003B4
198: ε U+003B5
199: ζ U+003B6
200: η U+003B7
201: θ U+003B8
202: ι U+003B9
203: κ U+003BA
204: λ U+003BB
205: μ U+003BC
206: ν U+003BD
207: ξ U+003BE
208: ο U+003BF
209: π U+003C0
210: ρ U+003C1
211: ς U+003C2
212: σ U+003C3
213: τ U+003C4
214: υ U+003C5
215: φ U+003C6
216: χ U+003C7
217: ψ U+003C8
218: ω U+003C9
219: ϑ U+003D1
220: ϒ U+003D2
221: ϖ U+003D6
222:   U+02002
223:   U+02003
224:   U+02009
225: ‌ U+0200C
226: ‍ U+0200D
227: ‎ U+0200E
228: ‏ U+0200F
229: – U+02013
230: — U+02014
231: ‘ U+02018
232: ’ U+02019
233: ‚ U+0201A
234: “ U+0201C
235: ” U+0201D
236: „ U+0201E
237: † U+02020
238: ‡ U+02021
239: • U+02022
240: … U+02026
241: ‰ U+02030
242: ′ U+02032
243: ″ U+02033
244: ‹ U+02039
245: › U+0203A
246: ‾ U+0203E
247: ⁄ U+02044
248: € U+020AC
249: ℑ U+02111
250: ℘ U+02118
251: ℜ U+0211C
252: ™ U+02122
253: ℵ U+02135
254: ← U+02190
255: ↑ U+02191
256: → U+02192
257: ↓ U+02193
258: ↔ U+02194
259: ↵ U+021B5
260: ⇐ U+021D0
261: ⇑ U+021D1
262: ⇒ U+021D2
263: ⇓ U+021D3
264: ⇔ U+021D4
265: ∀ U+02200
266: ∂ U+02202
267: ∃ U+02203
268: ∅ U+02205
269: ∇ U+02207
270: ∈ U+02208
271: ∉ U+02209
272: ∋ U+0220B
273: ∏ U+0220F
274: ∑ U+02211
275: − U+02212
276: ∗ U+02217
277: √ U+0221A
278: ∝ U+0221D
279: ∞ U+0221E
280: ∠ U+02220
281: ∧ U+02227
282: ∨ U+02228
283: ∩ U+02229
284: ∪ U+0222A
285: ∫ U+0222B
286: ∴ U+02234
287: ∼ U+0223C
288: ≅ U+02245
289: ≈ U+02248
290: ≠ U+02260
291: ≡ U+02261
292: ≤ U+02264
293: ≥ U+02265
294: ⊂ U+02282
295: ⊃ U+02283
296: ⊄ U+02284
297: ⊆ U+02286
298: ⊇ U+02287
299: ⊕ U+02295
300: ⊗ U+02297
301: ⊥ U+022A5
302: ⋅ U+022C5
303: ⌈ U+02308
304: ⌉ U+02309
305: ⌊ U+0230A
306: ⌋ U+0230B
307: ⟨ U+02329
308: ⟩ U+0232A
309: ◊ U+025CA
310: ♠ U+02660
311: ♣ U+02663
312: ♥ U+02665
313: ♦ U+02666
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>