Skip to content

Commit 7f0e86b

Browse files
committed
Convert Unicode halfwidth Yen sign to MacJapanese halfwidth Yen sign
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.
1 parent 4c39cd3 commit 7f0e86b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ mbfl_filt_conv_wchar_sjis_mac(int c, mbfl_convert_filter *filter)
425425
s1 |= 0x8080;
426426
} else if (c == 0xa0) {
427427
s1 = 0x00a0;
428-
} else if (c == 0xa5) { /* YEN SIGN */
429-
s1 = 0x216f; /* FULLWIDTH YEN SIGN */
428+
} else if (c == 0xa5) { /* YEN SIGN */
429+
/* Unicode has codepoint 0xFFE5 for a fullwidth Yen sign;
430+
* convert codepoint 0xA5 to halfwidth Yen sign */
431+
s1 = 0x5c; /* HALFWIDTH YEN SIGN */
430432
} else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
431433
s1 = 0x2140;
432434
}

0 commit comments

Comments
 (0)