Skip to content

Commit 299690a

Browse files
committed
Add more tests for ISO-2022-JP/JIS7/JIS8 text conversion
1 parent b2be85d commit 299690a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ext/mbstring/tests/iso2022jp_encoding.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,18 @@ for ($i = 0; $i <= 0xFF; $i++) {
187187

188188
echo "All escape sequences work as expected\n";
189189

190+
foreach (['JIS', 'ISO-2022-JP'] as $encoding) {
191+
testValidString("\x22\x25", "\x1B\$B!B\x1B(B", 'UTF-16BE', $encoding, false);
192+
testValidString("\xFF\x0D", "\x1B\$B!]\x1B(B", 'UTF-16BE', $encoding, false);
193+
testValidString("\xFF\xE0", "\x1B\$B!q\x1B(B", 'UTF-16BE', $encoding, false);
194+
testValidString("\xFF\xE1", "\x1B\$B!r\x1B(B", 'UTF-16BE', $encoding, false);
195+
testValidString("\xFF\xE2", "\x1B\$B\"L\x1B(B", 'UTF-16BE', $encoding, false);
196+
197+
testValidString("\x00\xA5", "\x1B(J\x5C\x1B(B", 'UTF-16BE', $encoding, false);
198+
}
199+
200+
echo "Other mappings from Unicode -> ISO-2022-JP are OK\n";
201+
190202
// Test "long" illegal character markers
191203
mb_substitute_character("long");
192204
convertInvalidString("\xE0", "BAD+E0", "JIS", "UTF-8");
@@ -204,4 +216,5 @@ JIS X 0201 support OK
204216
JIS X 0208 support OK
205217
JIS X 0212 support OK
206218
All escape sequences work as expected
219+
Other mappings from Unicode -> ISO-2022-JP are OK
207220
Done!

0 commit comments

Comments
 (0)