Skip to content

Commit ecf7184

Browse files
committed
Convert U+FF5E (FULLWIDTH TILDE) to 0x8160 (WAVE DASH) in SJIS variants
By entering this character in the JIS X 0208 conversion table, we can remove a bunch of explicit `if` clauses in different conversion filters. It also means that U+FF5E can be converted into SJIS-mac now; I don't know why this one SJIS variant rejected U+FF5E before, since 0x8160 means the same thing in SJIS-mac as the others.
1 parent 4f3bd2e commit ecf7184

File tree

7 files changed

+4
-17
lines changed

7 files changed

+4
-17
lines changed

ext/mbstring/libmbfl/filters/mbfilter_cp5022x.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,6 @@ mbfl_filt_conv_wchar_jis_ms(int c, mbfl_convert_filter *filter)
413413
s = 0x1007e;
414414
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
415415
s = 0x2140;
416-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
417-
s = 0x2141;
418416
} else if (c == 0x2225) { /* PARALLEL TO */
419417
s = 0x2142;
420418
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
@@ -629,8 +627,6 @@ mbfl_filt_conv_wchar_cp50221(int c, mbfl_convert_filter *filter)
629627
s = 0x1007e;
630628
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
631629
s = 0x2140;
632-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
633-
s = 0x2141;
634630
} else if (c == 0x2225) { /* PARALLEL TO */
635631
s = 0x2142;
636632
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
@@ -773,8 +769,6 @@ mbfl_filt_conv_wchar_cp50222(int c, mbfl_convert_filter *filter)
773769
s = 0x1007e;
774770
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
775771
s = 0x2140;
776-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
777-
s = 0x2141;
778772
} else if (c == 0x2225) { /* PARALLEL TO */
779773
s = 0x2142;
780774
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */

ext/mbstring/libmbfl/filters/mbfilter_cp51932.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ mbfl_filt_conv_wchar_cp51932(int c, mbfl_convert_filter *filter)
218218
s1 = 0x216F; /* FULLWIDTH YEN SIGN */
219219
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
220220
s1 = 0x2140;
221-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
222-
s1 = 0x2141;
223221
} else if (c == 0x2225) { /* PARALLEL TO */
224222
s1 = 0x2142;
225223
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */

ext/mbstring/libmbfl/filters/mbfilter_cp932.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ mbfl_filt_conv_wchar_cp932(int c, mbfl_convert_filter *filter)
255255
s1 = 0x216F; /* FULLWIDTH YEN SIGN */
256256
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
257257
s1 = 0x2140;
258-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
259-
s1 = 0x2141;
260258
} else if (c == 0x2225) { /* PARALLEL TO */
261259
s1 = 0x2142;
262260
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */

ext/mbstring/libmbfl/filters/mbfilter_jis.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter)
292292
s = 0x1007e;
293293
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
294294
s = 0x2140;
295-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
296-
s = 0x2141;
297295
} else if (c == 0x2225) { /* PARALLEL TO */
298296
s = 0x2142;
299297
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
@@ -389,8 +387,6 @@ mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter)
389387
s = 0x1007e;
390388
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
391389
s = 0x2140;
392-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
393-
s = 0x2141;
394390
} else if (c == 0x2225) { /* PARALLEL TO */
395391
s = 0x2142;
396392
} else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */

ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,6 @@ int mbfl_filt_conv_wchar_sjis_mobile(int c, mbfl_convert_filter *filter)
751751
s1 = 0x216F; /* FULLWIDTH YEN SIGN */
752752
} else if (c == 0xFF3c) { /* FULLWIDTH REVERSE SOLIDUS */
753753
s1 = 0x2140;
754-
} else if (c == 0xFF5E) { /* FULLWIDTH TILDE */
755-
s1 = 0x2141;
756754
} else if (c == 0x2225) { /* PARALLEL TO */
757755
s1 = 0x2142;
758756
} else if (c == 0xFF0D) { /* FULLWIDTH HYPHEN-MINUS */

ext/mbstring/libmbfl/filters/unicode_table_jis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5824,7 +5824,7 @@ const unsigned short ucs_r_jis_table[] = {
58245824
0x212E,0x2361,0x2362,0x2363,0x2364,0x2365,0x2366,0x2367,
58255825
0x2368,0x2369,0x236A,0x236B,0x236C,0x236D,0x236E,0x236F,
58265826
0x2370,0x2371,0x2372,0x2373,0x2374,0x2375,0x2376,0x2377,
5827-
0x2378,0x2379,0x237A,0x2150,0x2143,0x2151,0x0000,0x0000,
5827+
0x2378,0x2379,0x237A,0x2150,0x2143,0x2151,0x2141,0x0000,
58285828
0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
58295829
0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
58305830
0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,

ext/mbstring/tests/sjismac_encoding.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ $fromUnicode["\x20\x15"] = "\x81\x5C";
6565
/* Convert U+203E (OVERLINE) to 0x8150 (FULLWIDTH MACRON) */
6666
$fromUnicode["\x20\x3E"] = "\x81\x50";
6767

68+
/* Convert U+FF5E (FULLWIDTH TILDE) to 0x8160 (WAVE DASH) */
69+
$fromUnicode["\xFF\x5E"] = "\x81\x60";
70+
6871
testAllValidChars($validChars, 'SJIS-mac', 'UTF-32BE');
6972
echo "MacJapanese verification and conversion works on all valid characters\n";
7073

0 commit comments

Comments
 (0)