summaryrefslogtreecommitdiff
path: root/ext/mbstring
diff options
context:
space:
mode:
authorAlex Dowad <alexinbeijing@gmail.com>2020-10-11 14:50:20 +0200
committerAlex Dowad <alexinbeijing@gmail.com>2021-01-15 08:26:38 +0200
commit6e9c8386cb51be711435b203e68efe099c51b84a (patch)
treeb69116e035ab79633762f39f1c5200988f4fcd36 /ext/mbstring
parentcdd07242919d7de020bd631385272b38591fc7ca (diff)
downloadphp-git-6e9c8386cb51be711435b203e68efe099c51b84a.tar.gz
CP5022{0,1,2}: convert characters in ku 0x2D (13th row) correctly
Essentially, CP5022{0,1,2} are to CP932 as ISO-2022-JP is to Shift-JIS. As Shift-JIS and ISO-2022-JP both encode characters from the JIS X 0208 charset, CP932 and CP5022x both encode characters from JIS X 0208 _plus_ extra characters added as MicroSoft vendor extensions. Among the added characters are a number of symbols which MS put in the 13th row of the 94x94 character table. (In JIS X 0208, that row is empty.) mbfilter_cp50220x.c had an `if` clause which was intended to handle the conversion of characters in that 13th row, but it was dead code, as the previous clause was always true in those cases. The solution is to reverse the order of those two clauses (just as they already appeared in mbfilter_cp932.c).
Diffstat (limited to 'ext/mbstring')
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c b/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c
index 8a79b98a41..1d3114a695 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c
@@ -247,10 +247,10 @@ retry:
if (c > 0x20 && c < 0x7f) {
s = (c1 - 0x21)*94 + c - 0x21;
if (filter->status == 0x80) {
- if (s >= 0 && s < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[s];
- } else if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) {
+ if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) {
w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min];
+ } else if (s >= 0 && s < jisx0208_ucs_table_size) {
+ w = jisx0208_ucs_table[s];
} else if (s >= cp932ext2_ucs_table_min && s < cp932ext2_ucs_table_max) {
w = cp932ext2_ucs_table[s - cp932ext2_ucs_table_min];
} else if (s >= cp932ext3_ucs_table_min && s < cp932ext3_ucs_table_max) {