Annotation of embedaddon/php/ext/standard/tests/strings/html_entity_decode_win1251.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Translation of HTML entities for encoding WIN-1251
3: --FILE--
4: <?php
5: $arr = array(
6: 0x0402 => array(0x80, "CYRILLIC CAPITAL LETTER DJE"),
7: 0x0403 => array(0x81, "CYRILLIC CAPITAL LETTER GJE"),
8: 0x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"),
9: 0x0453 => array(0x83, "CYRILLIC SMALL LETTER GJE"),
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: 0x20AC => array(0x88, "EURO SIGN"),
15: 0x2030 => array(0x89, "PER MILLE SIGN"),
16: 0x0409 => array(0x8A, "CYRILLIC CAPITAL LETTER LJE"),
17: 0x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
18: 0x040A => array(0x8C, "CYRILLIC CAPITAL LETTER NJE"),
19: 0x040C => array(0x8D, "CYRILLIC CAPITAL LETTER KJE"),
20: 0x040B => array(0x8E, "CYRILLIC CAPITAL LETTER TSHE"),
21: 0x040F => array(0x8F, "CYRILLIC CAPITAL LETTER DZHE"),
22: 0x0452 => array(0x90, "CYRILLIC SMALL LETTER DJE"),
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: //0x98 #UNDEFINED
31: 0x2122 => array(0x99, "TRADE MARK SIGN"),
32: 0x0459 => array(0x9A, "CYRILLIC SMALL LETTER LJE"),
33: 0x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
34: 0x045A => array(0x9C, "CYRILLIC SMALL LETTER NJE"),
35: 0x045C => array(0x9D, "CYRILLIC SMALL LETTER KJE"),
36: 0x045B => array(0x9E, "CYRILLIC SMALL LETTER TSHE"),
37: 0x045F => array(0x9F, "CYRILLIC SMALL LETTER DZHE"),
38: 0x00A0 => array(0xA0, "NO-BREAK SPACE"),
39: 0x040E => array(0xA1, "CYRILLIC CAPITAL LETTER SHORT U"),
40: 0x045E => array(0xA2, "CYRILLIC SMALL LETTER SHORT U"),
41: 0x0408 => array(0xA3, "CYRILLIC CAPITAL LETTER JE"),
42: 0x00A4 => array(0xA4, "CURRENCY SIGN"),
43: 0x0490 => array(0xA5, "CYRILLIC CAPITAL LETTER GHE WITH UPTURN"),
44: 0x00A6 => array(0xA6, "BROKEN BAR"),
45: 0x00A7 => array(0xA7, "SECTION SIGN"),
46: 0x0401 => array(0xA8, "CYRILLIC CAPITAL LETTER IO"),
47: 0x00A9 => array(0xA9, "COPYRIGHT SIGN"),
48: 0x0404 => array(0xAA, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"),
49: 0x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"),
50: 0x00AC => array(0xAC, "NOT SIGN"),
51: 0x00AD => array(0xAD, "SOFT HYPHEN"),
52: 0x00AE => array(0xAE, "REGISTERED SIGN"),
53: 0x0407 => array(0xAF, "CYRILLIC CAPITAL LETTER YI"),
54: 0x00B0 => array(0xB0, "DEGREE SIGN"),
55: 0x00B1 => array(0xB1, "PLUS-MINUS SIGN"),
56: 0x0406 => array(0xB2, "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I"),
57: 0x0456 => array(0xB3, "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I"),
58: 0x0491 => array(0xB4, "CYRILLIC SMALL LETTER GHE WITH UPTURN"),
59: 0x00B5 => array(0xB5, "MICRO SIGN"),
60: 0x00B6 => array(0xB6, "PILCROW SIGN"),
61: 0x00B7 => array(0xB7, "MIDDLE DOT"),
62: 0x0451 => array(0xB8, "CYRILLIC SMALL LETTER IO"),
63: 0x2116 => array(0xB9, "NUMERO SIGN"),
64: 0x0454 => array(0xBA, "CYRILLIC SMALL LETTER UKRAINIAN IE"),
65: 0x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"),
66: 0x0458 => array(0xBC, "CYRILLIC SMALL LETTER JE"),
67: 0x0405 => array(0xBD, "CYRILLIC CAPITAL LETTER DZE"),
68: 0x0455 => array(0xBE, "CYRILLIC SMALL LETTER DZE"),
69: 0x0457 => array(0xBF, "CYRILLIC SMALL LETTER YI"),
70: 0x0410 => array(0xC0, "CYRILLIC CAPITAL LETTER A"),
71: 0x0411 => array(0xC1, "CYRILLIC CAPITAL LETTER BE"),
72: 0x0412 => array(0xC2, "CYRILLIC CAPITAL LETTER VE"),
73: 0x0413 => array(0xC3, "CYRILLIC CAPITAL LETTER GHE"),
74: 0x0414 => array(0xC4, "CYRILLIC CAPITAL LETTER DE"),
75: 0x0415 => array(0xC5, "CYRILLIC CAPITAL LETTER IE"),
76: 0x0416 => array(0xC6, "CYRILLIC CAPITAL LETTER ZHE"),
77: 0x0417 => array(0xC7, "CYRILLIC CAPITAL LETTER ZE"),
78: 0x0418 => array(0xC8, "CYRILLIC CAPITAL LETTER I"),
79: 0x0419 => array(0xC9, "CYRILLIC CAPITAL LETTER SHORT I"),
80: 0x041A => array(0xCA, "CYRILLIC CAPITAL LETTER KA"),
81: 0x041B => array(0xCB, "CYRILLIC CAPITAL LETTER EL"),
82: 0x041C => array(0xCC, "CYRILLIC CAPITAL LETTER EM"),
83: 0x041D => array(0xCD, "CYRILLIC CAPITAL LETTER EN"),
84: 0x041E => array(0xCE, "CYRILLIC CAPITAL LETTER O"),
85: 0x041F => array(0xCF, "CYRILLIC CAPITAL LETTER PE"),
86: 0x0420 => array(0xD0, "CYRILLIC CAPITAL LETTER ER"),
87: 0x0421 => array(0xD1, "CYRILLIC CAPITAL LETTER ES"),
88: 0x0422 => array(0xD2, "CYRILLIC CAPITAL LETTER TE"),
89: 0x0423 => array(0xD3, "CYRILLIC CAPITAL LETTER U"),
90: 0x0424 => array(0xD4, "CYRILLIC CAPITAL LETTER EF"),
91: 0x0425 => array(0xD5, "CYRILLIC CAPITAL LETTER HA"),
92: 0x0426 => array(0xD6, "CYRILLIC CAPITAL LETTER TSE"),
93: 0x0427 => array(0xD7, "CYRILLIC CAPITAL LETTER CHE"),
94: 0x0428 => array(0xD8, "CYRILLIC CAPITAL LETTER SHA"),
95: 0x0429 => array(0xD9, "CYRILLIC CAPITAL LETTER SHCHA"),
96: 0x042A => array(0xDA, "CYRILLIC CAPITAL LETTER HARD SIGN"),
97: 0x042B => array(0xDB, "CYRILLIC CAPITAL LETTER YERU"),
98: 0x042C => array(0xDC, "CYRILLIC CAPITAL LETTER SOFT SIGN"),
99: 0x042D => array(0xDD, "CYRILLIC CAPITAL LETTER E"),
100: 0x042E => array(0xDE, "CYRILLIC CAPITAL LETTER YU"),
101: 0x042F => array(0xDF, "CYRILLIC CAPITAL LETTER YA"),
102: 0x0430 => array(0xE0, "CYRILLIC SMALL LETTER A"),
103: 0x0431 => array(0xE1, "CYRILLIC SMALL LETTER BE"),
104: 0x0432 => array(0xE2, "CYRILLIC SMALL LETTER VE"),
105: 0x0433 => array(0xE3, "CYRILLIC SMALL LETTER GHE"),
106: 0x0434 => array(0xE4, "CYRILLIC SMALL LETTER DE"),
107: 0x0435 => array(0xE5, "CYRILLIC SMALL LETTER IE"),
108: 0x0436 => array(0xE6, "CYRILLIC SMALL LETTER ZHE"),
109: 0x0437 => array(0xE7, "CYRILLIC SMALL LETTER ZE"),
110: 0x0438 => array(0xE8, "CYRILLIC SMALL LETTER I"),
111: 0x0439 => array(0xE9, "CYRILLIC SMALL LETTER SHORT I"),
112: 0x043A => array(0xEA, "CYRILLIC SMALL LETTER KA"),
113: 0x043B => array(0xEB, "CYRILLIC SMALL LETTER EL"),
114: 0x043C => array(0xEC, "CYRILLIC SMALL LETTER EM"),
115: 0x043D => array(0xED, "CYRILLIC SMALL LETTER EN"),
116: 0x043E => array(0xEE, "CYRILLIC SMALL LETTER O"),
117: 0x043F => array(0xEF, "CYRILLIC SMALL LETTER PE"),
118: 0x0440 => array(0xF0, "CYRILLIC SMALL LETTER ER"),
119: 0x0441 => array(0xF1, "CYRILLIC SMALL LETTER ES"),
120: 0x0442 => array(0xF2, "CYRILLIC SMALL LETTER TE"),
121: 0x0443 => array(0xF3, "CYRILLIC SMALL LETTER U"),
122: 0x0444 => array(0xF4, "CYRILLIC SMALL LETTER EF"),
123: 0x0445 => array(0xF5, "CYRILLIC SMALL LETTER HA"),
124: 0x0446 => array(0xF6, "CYRILLIC SMALL LETTER TSE"),
125: 0x0447 => array(0xF7, "CYRILLIC SMALL LETTER CHE"),
126: 0x0448 => array(0xF8, "CYRILLIC SMALL LETTER SHA"),
127: 0x0449 => array(0xF9, "CYRILLIC SMALL LETTER SHCHA"),
128: 0x044A => array(0xFA, "CYRILLIC SMALL LETTER HARD SIGN"),
129: 0x044B => array(0xFB, "CYRILLIC SMALL LETTER YERU"),
130: 0x044C => array(0xFC, "CYRILLIC SMALL LETTER SOFT SIGN"),
131: 0x044D => array(0xFD, "CYRILLIC SMALL LETTER E"),
132: 0x044E => array(0xFE, "CYRILLIC SMALL LETTER YU"),
133: 0x044F => array(0xFF, "CYRILLIC SMALL LETTER YA"),
134: );
135:
136: $res = html_entity_decode("˜", ENT_QUOTES, 'WINDOWS-1251');
137: echo "Special test for ˜ (shouldn't decode):\n";
138: echo $res,"\n\n";
139:
140: foreach ($arr as $u => $v) {
141: $ent = sprintf("&#x%X;", $u);
142: $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1251');
143: $d = unpack("H*", $res);
144: echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
145:
146: $ent = sprintf("&#x%X;", $v[0]);
147: $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1251');
148: if ($res[0] != "&" || $res[1] != "#")
149: $res = unpack("H*", $res)[1];
150: echo sprintf("%s => %s\n\n", $ent, $res);
151: }
152: --EXPECT--
153: Special test for ˜ (shouldn't decode):
154: ˜
155:
156: CYRILLIC CAPITAL LETTER DJE: Ђ => 80
157: € => €
158:
159: CYRILLIC CAPITAL LETTER GJE: Ѓ => 81
160:  => 
161:
162: SINGLE LOW-9 QUOTATION MARK: ‚ => 82
163: ‚ => ‚
164:
165: CYRILLIC SMALL LETTER GJE: ѓ => 83
166: ƒ => ƒ
167:
168: DOUBLE LOW-9 QUOTATION MARK: „ => 84
169: „ => „
170:
171: HORIZONTAL ELLIPSIS: … => 85
172: … => …
173:
174: DAGGER: † => 86
175: † => †
176:
177: DOUBLE DAGGER: ‡ => 87
178: ‡ => ‡
179:
180: EURO SIGN: € => 88
181: ˆ => ˆ
182:
183: PER MILLE SIGN: ‰ => 89
184: ‰ => ‰
185:
186: CYRILLIC CAPITAL LETTER LJE: Љ => 8a
187: Š => Š
188:
189: SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => 8b
190: ‹ => ‹
191:
192: CYRILLIC CAPITAL LETTER NJE: Њ => 8c
193: Œ => Œ
194:
195: CYRILLIC CAPITAL LETTER KJE: Ќ => 8d
196:  => 
197:
198: CYRILLIC CAPITAL LETTER TSHE: Ћ => 8e
199: Ž => Ž
200:
201: CYRILLIC CAPITAL LETTER DZHE: Џ => 8f
202:  => 
203:
204: CYRILLIC SMALL LETTER DJE: ђ => 90
205:  => 
206:
207: LEFT SINGLE QUOTATION MARK: ‘ => 91
208: ‘ => ‘
209:
210: RIGHT SINGLE QUOTATION MARK: ’ => 92
211: ’ => ’
212:
213: LEFT DOUBLE QUOTATION MARK: “ => 93
214: “ => “
215:
216: RIGHT DOUBLE QUOTATION MARK: ” => 94
217: ” => ”
218:
219: BULLET: • => 95
220: • => •
221:
222: EN DASH: – => 96
223: – => –
224:
225: EM DASH: — => 97
226: — => —
227:
228: TRADE MARK SIGN: ™ => 99
229: ™ => ™
230:
231: CYRILLIC SMALL LETTER LJE: љ => 9a
232: š => š
233:
234: SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => 9b
235: › => ›
236:
237: CYRILLIC SMALL LETTER NJE: њ => 9c
238: œ => œ
239:
240: CYRILLIC SMALL LETTER KJE: ќ => 9d
241:  => 
242:
243: CYRILLIC SMALL LETTER TSHE: ћ => 9e
244: ž => ž
245:
246: CYRILLIC SMALL LETTER DZHE: џ => 9f
247: Ÿ => Ÿ
248:
249: NO-BREAK SPACE:   => a0
250:   => a0
251:
252: CYRILLIC CAPITAL LETTER SHORT U: Ў => a1
253: ¡ => ¡
254:
255: CYRILLIC SMALL LETTER SHORT U: ў => a2
256: ¢ => ¢
257:
258: CYRILLIC CAPITAL LETTER JE: Ј => a3
259: £ => £
260:
261: CURRENCY SIGN: ¤ => a4
262: ¤ => a4
263:
264: CYRILLIC CAPITAL LETTER GHE WITH UPTURN: Ґ => a5
265: ¥ => ¥
266:
267: BROKEN BAR: ¦ => a6
268: ¦ => a6
269:
270: SECTION SIGN: § => a7
271: § => a7
272:
273: CYRILLIC CAPITAL LETTER IO: Ё => a8
274: ¨ => ¨
275:
276: COPYRIGHT SIGN: © => a9
277: © => a9
278:
279: CYRILLIC CAPITAL LETTER UKRAINIAN IE: Є => aa
280: ª => ª
281:
282: LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => ab
283: « => ab
284:
285: NOT SIGN: ¬ => ac
286: ¬ => ac
287:
288: SOFT HYPHEN: ­ => ad
289: ­ => ad
290:
291: REGISTERED SIGN: ® => ae
292: ® => ae
293:
294: CYRILLIC CAPITAL LETTER YI: Ї => af
295: ¯ => ¯
296:
297: DEGREE SIGN: ° => b0
298: ° => b0
299:
300: PLUS-MINUS SIGN: ± => b1
301: ± => b1
302:
303: CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: І => b2
304: ² => ²
305:
306: CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: і => b3
307: ³ => ³
308:
309: CYRILLIC SMALL LETTER GHE WITH UPTURN: ґ => b4
310: ´ => ´
311:
312: MICRO SIGN: µ => b5
313: µ => b5
314:
315: PILCROW SIGN: ¶ => b6
316: ¶ => b6
317:
318: MIDDLE DOT: · => b7
319: · => b7
320:
321: CYRILLIC SMALL LETTER IO: ё => b8
322: ¸ => ¸
323:
324: NUMERO SIGN: № => b9
325: ¹ => ¹
326:
327: CYRILLIC SMALL LETTER UKRAINIAN IE: є => ba
328: º => º
329:
330: RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => bb
331: » => bb
332:
333: CYRILLIC SMALL LETTER JE: ј => bc
334: ¼ => ¼
335:
336: CYRILLIC CAPITAL LETTER DZE: Ѕ => bd
337: ½ => ½
338:
339: CYRILLIC SMALL LETTER DZE: ѕ => be
340: ¾ => ¾
341:
342: CYRILLIC SMALL LETTER YI: ї => bf
343: ¿ => ¿
344:
345: CYRILLIC CAPITAL LETTER A: А => c0
346: À => À
347:
348: CYRILLIC CAPITAL LETTER BE: Б => c1
349: Á => Á
350:
351: CYRILLIC CAPITAL LETTER VE: В => c2
352: Â => Â
353:
354: CYRILLIC CAPITAL LETTER GHE: Г => c3
355: Ã => Ã
356:
357: CYRILLIC CAPITAL LETTER DE: Д => c4
358: Ä => Ä
359:
360: CYRILLIC CAPITAL LETTER IE: Е => c5
361: Å => Å
362:
363: CYRILLIC CAPITAL LETTER ZHE: Ж => c6
364: Æ => Æ
365:
366: CYRILLIC CAPITAL LETTER ZE: З => c7
367: Ç => Ç
368:
369: CYRILLIC CAPITAL LETTER I: И => c8
370: È => È
371:
372: CYRILLIC CAPITAL LETTER SHORT I: Й => c9
373: É => É
374:
375: CYRILLIC CAPITAL LETTER KA: К => ca
376: Ê => Ê
377:
378: CYRILLIC CAPITAL LETTER EL: Л => cb
379: Ë => Ë
380:
381: CYRILLIC CAPITAL LETTER EM: М => cc
382: Ì => Ì
383:
384: CYRILLIC CAPITAL LETTER EN: Н => cd
385: Í => Í
386:
387: CYRILLIC CAPITAL LETTER O: О => ce
388: Î => Î
389:
390: CYRILLIC CAPITAL LETTER PE: П => cf
391: Ï => Ï
392:
393: CYRILLIC CAPITAL LETTER ER: Р => d0
394: Ð => Ð
395:
396: CYRILLIC CAPITAL LETTER ES: С => d1
397: Ñ => Ñ
398:
399: CYRILLIC CAPITAL LETTER TE: Т => d2
400: Ò => Ò
401:
402: CYRILLIC CAPITAL LETTER U: У => d3
403: Ó => Ó
404:
405: CYRILLIC CAPITAL LETTER EF: Ф => d4
406: Ô => Ô
407:
408: CYRILLIC CAPITAL LETTER HA: Х => d5
409: Õ => Õ
410:
411: CYRILLIC CAPITAL LETTER TSE: Ц => d6
412: Ö => Ö
413:
414: CYRILLIC CAPITAL LETTER CHE: Ч => d7
415: × => ×
416:
417: CYRILLIC CAPITAL LETTER SHA: Ш => d8
418: Ø => Ø
419:
420: CYRILLIC CAPITAL LETTER SHCHA: Щ => d9
421: Ù => Ù
422:
423: CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => da
424: Ú => Ú
425:
426: CYRILLIC CAPITAL LETTER YERU: Ы => db
427: Û => Û
428:
429: CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => dc
430: Ü => Ü
431:
432: CYRILLIC CAPITAL LETTER E: Э => dd
433: Ý => Ý
434:
435: CYRILLIC CAPITAL LETTER YU: Ю => de
436: Þ => Þ
437:
438: CYRILLIC CAPITAL LETTER YA: Я => df
439: ß => ß
440:
441: CYRILLIC SMALL LETTER A: а => e0
442: à => à
443:
444: CYRILLIC SMALL LETTER BE: б => e1
445: á => á
446:
447: CYRILLIC SMALL LETTER VE: в => e2
448: â => â
449:
450: CYRILLIC SMALL LETTER GHE: г => e3
451: ã => ã
452:
453: CYRILLIC SMALL LETTER DE: д => e4
454: ä => ä
455:
456: CYRILLIC SMALL LETTER IE: е => e5
457: å => å
458:
459: CYRILLIC SMALL LETTER ZHE: ж => e6
460: æ => æ
461:
462: CYRILLIC SMALL LETTER ZE: з => e7
463: ç => ç
464:
465: CYRILLIC SMALL LETTER I: и => e8
466: è => è
467:
468: CYRILLIC SMALL LETTER SHORT I: й => e9
469: é => é
470:
471: CYRILLIC SMALL LETTER KA: к => ea
472: ê => ê
473:
474: CYRILLIC SMALL LETTER EL: л => eb
475: ë => ë
476:
477: CYRILLIC SMALL LETTER EM: м => ec
478: ì => ì
479:
480: CYRILLIC SMALL LETTER EN: н => ed
481: í => í
482:
483: CYRILLIC SMALL LETTER O: о => ee
484: î => î
485:
486: CYRILLIC SMALL LETTER PE: п => ef
487: ï => ï
488:
489: CYRILLIC SMALL LETTER ER: р => f0
490: ð => ð
491:
492: CYRILLIC SMALL LETTER ES: с => f1
493: ñ => ñ
494:
495: CYRILLIC SMALL LETTER TE: т => f2
496: ò => ò
497:
498: CYRILLIC SMALL LETTER U: у => f3
499: ó => ó
500:
501: CYRILLIC SMALL LETTER EF: ф => f4
502: ô => ô
503:
504: CYRILLIC SMALL LETTER HA: х => f5
505: õ => õ
506:
507: CYRILLIC SMALL LETTER TSE: ц => f6
508: ö => ö
509:
510: CYRILLIC SMALL LETTER CHE: ч => f7
511: ÷ => ÷
512:
513: CYRILLIC SMALL LETTER SHA: ш => f8
514: ø => ø
515:
516: CYRILLIC SMALL LETTER SHCHA: щ => f9
517: ù => ù
518:
519: CYRILLIC SMALL LETTER HARD SIGN: ъ => fa
520: ú => ú
521:
522: CYRILLIC SMALL LETTER YERU: ы => fb
523: û => û
524:
525: CYRILLIC SMALL LETTER SOFT SIGN: ь => fc
526: ü => ü
527:
528: CYRILLIC SMALL LETTER E: э => fd
529: ý => ý
530:
531: CYRILLIC SMALL LETTER YU: ю => fe
532: þ => þ
533:
534: CYRILLIC SMALL LETTER YA: я => ff
535: ÿ => ÿ
536:
537:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>