com php-src: Fix mbstring support for Shift-JIS: Zend/tests/mul tibyte/multibyte_encoding_001.phpt ext/mbstring/l ibmbfl/filters/mbfilter_sjis.c
ext/mbstring/tests/bug4 7399.phpt ext/mbstring/tests/data/SHIFTJIS.txt ext/mbstring/tests/sjis_encoding.phpt
| From: | Alex Dowad | Date: | Mon, 09 Nov 2020 11:45:16 +0000 |
| Subject: | com php-src: Fix mbstring support for Shift-JIS: Zend/tests/mul tibyte/multibyte_encoding_001.phpt ext/mbstring/l ibmbfl/filters/mbfilter_sjis.c ext/mbstring/tests/bug4 7399.phpt ext/mbstring/tests/data/SHIFTJIS.txt ext/mbstring/tests/sjis_encoding.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-114090@lists.php.net to get a copy of this message | ||
Commit: ad7e0f16ccee09a28b4cb78055937f513aef9e61
Author: Alex Dowad <alexinbeijing@gmail.com> Mon, 19 Oct 2020 20:57:58 +0200
Parents: cc03c54c369a1a7dfc71b58f4a59edc46c3f9171
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad7e0f16ccee09a28b4cb78055937f513aef9e61
Log:
Fix mbstring support for Shift-JIS
- Reject otherwise valid kuten codes which don't map to anything in JIS X 0208.
- Handle truncated multi-byte characters as an error.
- Convert Shift-JIS 0x7E to Unicode 0x203E (overline) as recommended by the
Unicode Consortium, and as iconv does.
- Convert Shift-JIS 0x5C to Unicode 0xA5 (yen sign) as recommended by the
Unicode Consortium, and as iconv does.
(NOTE: This will affect PHP scripts which use an internal encoding of
Shift-JIS! PHP assigns a special meaning to 0x5C, the backslash. For example,
it is used for escapes in double-quoted strings. Mapping the Shift-JIS yen
sign to the Unicode yen sign means the yen sign will not be usable for
C escapes in double-quoted strings. Japanese PHP programmers who want to
write their source code in Shift-JIS for some strange reason will have to
use the JIS X 0208 backlash or 'REVERSE SOLIDUS' character for their C
escapes.)
- Convert Unicode 0x5C (backslash) to Shift-JIS 0x815F (reverse solidus).
- Immediately handle error if first Shift-JIS byte is over 0xEF, rather than
waiting to see the next byte. (Previously, the value used was 0xFC, which is
the limit for the 2nd byte and not the 1st byte of a multi-byte character.)
- Don't allow 'control characters' to appear in the middle of a multi-byte
character.
The test case for bug 47399 is now obsolete. That test assumed that a number
of Shift-JIS byte sequences which don't map to any character were 'valid'
(because the byte values were within the legal ranges).
Bugs:
https://bugs.php.net/47399
Changed paths:
M Zend/tests/multibyte/multibyte_encoding_001.phpt
M ext/mbstring/libmbfl/filters/mbfilter_sjis..c
D ext/mbstring/tests/bug47399.phpt
A ext/mbstring/tests/data/SHIFTJIS.txt
A ext/mbstring/tests/sjis_encoding.phpt
Diff: <Diff exceeded maximum size>