mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix mb_strlen is wrong length for CP932 when 0x80.
This commit is contained in:
parent
b374ec399d
commit
c50172e812
2 changed files with 10 additions and 2 deletions
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
static int mbfl_filt_conv_cp932_wchar_flush(mbfl_convert_filter *filter);
|
static int mbfl_filt_conv_cp932_wchar_flush(mbfl_convert_filter *filter);
|
||||||
|
|
||||||
static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */
|
static const unsigned char mblen_table_sjis[] = { /* 0x81-0x9f,0xE0-0xFF */
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
@ -74,7 +74,7 @@ static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
|
|
@ -35,6 +35,11 @@ print "-- Testing illegal bytes 0x80,0xFD-FF --\n";
|
||||||
print mb_strlen("\x80\xA1", 'SJIS') . "\n";
|
print mb_strlen("\x80\xA1", 'SJIS') . "\n";
|
||||||
print mb_strlen("abc\xFD\xFE\xFF", 'SJIS') . "\n";
|
print mb_strlen("abc\xFD\xFE\xFF", 'SJIS') . "\n";
|
||||||
|
|
||||||
|
echo "== CP932 ==\n";
|
||||||
|
print mb_strlen("\x80\xA1", "CP932") . "\n";
|
||||||
|
// 0xFD, 0xFE, 0xFF is reserved.
|
||||||
|
print mb_strlen("abc\xFD\xFE\xFF", 'CP932') . "\n";
|
||||||
|
|
||||||
echo "== MacJapanese ==\n";
|
echo "== MacJapanese ==\n";
|
||||||
print mb_strlen("\x80\xA1", 'MacJapanese') . "\n";
|
print mb_strlen("\x80\xA1", 'MacJapanese') . "\n";
|
||||||
print mb_strlen("abc\xFD\xFE\xFF", 'MacJapanese') . "\n";
|
print mb_strlen("abc\xFD\xFE\xFF", 'MacJapanese') . "\n";
|
||||||
|
@ -91,6 +96,9 @@ try {
|
||||||
-- Testing illegal bytes 0x80,0xFD-FF --
|
-- Testing illegal bytes 0x80,0xFD-FF --
|
||||||
2
|
2
|
||||||
6
|
6
|
||||||
|
== CP932 ==
|
||||||
|
2
|
||||||
|
5
|
||||||
== MacJapanese ==
|
== MacJapanese ==
|
||||||
2
|
2
|
||||||
6
|
6
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue