xref: /PHP-7.0/ext/mbstring/tests/bug30549.phpt (revision c92ae847)
1--TEST--
2Bug #30549 (incorrect character translations for some ISO8859 charsets)
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5--FILE--
6<?php
7test('ISO-8859-7',  array(0xa4 => 0x20ac, 0xa5 => 0x20af, 0xaa => 0x037a));
8test('ISO-8859-8',  array(0xaf => 0x00af, 0xfd => 0x200e, 0xfe => 0x200f));
9test('ISO-8859-10', array(0xa4 => 0x012a                                ));
10
11function test($enc, $map) {
12	print "$enc\n";
13
14	foreach($map as $fromc => $toc) {
15		$ustr = mb_convert_encoding(pack('C', $fromc), 'UCS-4BE', $enc);
16		foreach (unpack('Nc', $ustr) as $unic);
17		printf("0x%04x, 0x%04x\n", $toc, $unic);
18	}
19}
20?>
21--EXPECT--
22ISO-8859-7
230x20ac, 0x20ac
240x20af, 0x20af
250x037a, 0x037a
26ISO-8859-8
270x00af, 0x00af
280x200e, 0x200e
290x200f, 0x200f
30ISO-8859-10
310x012a, 0x012a
32