summaryrefslogtreecommitdiff
path: root/ext/mbstring
diff options
context:
space:
mode:
authorAlex Dowad <alexinbeijing@gmail.com>2020-09-17 22:34:59 +0200
committerAlex Dowad <alexinbeijing@gmail.com>2020-11-11 11:18:58 +0200
commiteda73a5f6f17824e42db5ba433de8839ce57713b (patch)
treed22ed1c9ea6a224894e1661f8a04b2026fd0bd28 /ext/mbstring
parent2f98bd8844de080dd212847c17f3c4c10542b4f4 (diff)
downloadphp-git-eda73a5f6f17824e42db5ba433de8839ce57713b.tar.gz
Don't mangle non-Japanese chars which appear after a 'combining' kana in SJIS-2004
Unicode has 'combining' characters which join with another following character. Japanese hiragana and katakana with the 'two dots' voice mark can be represented in this way, with one Unicode character for the 'base' kana and another one which adds the voice mark. In SJIS-2004, however, there are dedicated characters for voiced and unvoiced kana. So some special checks are done to identify sequences of Unicode characters which need to be 'collapsed' into a single SJIS-2004 character. If a kana is immediately followed by some other unrelated character, like a Cyrillic letter, then the cached kana should be output 'as is' and we proceed with encoding the unrelated character. When doing this, though, we need to re-initialize local variables, or else the unrelated character will be mangled in some cases.
Diffstat (limited to 'ext/mbstring')
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c
index a81cd29b70..02bbdccdc8 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.c
@@ -485,10 +485,10 @@ int mbfl_filt_conv_jis2004_wchar_flush(mbfl_convert_filter *filter)
int
mbfl_filt_conv_wchar_jis2004(int c, mbfl_convert_filter *filter) {
int k;
- int c1, c2, s1 = 0, s2;
+ int c1, c2, s1, s2;
retry:
-
+ s1 = 0;
/* check for 1st char of combining characters */
if ((filter->status & 0xf)== 0 && (
c == 0x00E6 ||