]> granicus.if.org Git - php/commitdiff
Convert Unicode halfwidth Yen sign to MacJapanese halfwidth Yen sign
authorAlex Dowad <alexinbeijing@gmail.com>
Sat, 19 Sep 2020 12:27:14 +0000 (14:27 +0200)
committerAlex Dowad <alexinbeijing@gmail.com>
Wed, 11 Nov 2020 09:18:58 +0000 (11:18 +0200)
Since 1993, Unicode has had a specific codepoint for a fullwidth Yen sign.
Likewise, MacJapanese has separate kuten codes for halfwidth and fullwidth
Yen signs. But mbstring mapped _both_ Yen sign codepoints to the
MacJapanese fullwidth Yen sign.

It's probably more appropriate to map the 'ordinary' Yen sign to the
MacJapanese halfwidth Yen sign. Besides, this means that the conversion
between Unicode and MacJapanese is closer to being lossless and reversible.

ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c

index e794e1775ae542c8974d16a70369181617822f0c..5214c429983910bb5701f66ef3452a06199b0a5e 100644 (file)
@@ -425,8 +425,10 @@ mbfl_filt_conv_wchar_sjis_mac(int c, mbfl_convert_filter *filter)
                                s1 |= 0x8080;
                        } else if (c == 0xa0) {
                                s1 = 0x00a0;
-                       } else if (c == 0xa5) {         /* YEN SIGN */
-                               s1 = 0x216f;    /* FULLWIDTH YEN SIGN */
+                       } else if (c == 0xa5) { /* YEN SIGN */
+                               /* Unicode has codepoint 0xFFE5 for a fullwidth Yen sign;
+                                * convert codepoint 0xA5 to halfwidth Yen sign */
+                               s1 = 0x5c; /* HALFWIDTH YEN SIGN */
                        } else if (c == 0xff3c) {       /* FULLWIDTH REVERSE SOLIDUS */
                                s1 = 0x2140;
                        }