From f03f51dccf606bd9ba89991e67132bf58e6fcdf0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 9 Apr 2009 08:20:10 +0000 Subject: * libc/stdlib/mbctype.h (_iseucjp1): Like _iseucjp, but also recognizes 0x8e and 0x8f lead bytes. (_iseucjp2): Rename from _iseucjp. * libc/stdlib/mbtowc_r.c (__eucjp_mbtowc): Convert JIS-X-0212 triplebyte sequences as well. * libc/stdlib/wctomb_r.c (__eucjp_wctomb): Convert to JIS-X-0212 triplebyte sequences as well. --- newlib/libc/stdlib/wctomb_r.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'newlib/libc/stdlib/wctomb_r.c') diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c index 64210f232..95a04069c 100644 --- a/newlib/libc/stdlib/wctomb_r.c +++ b/newlib/libc/stdlib/wctomb_r.c @@ -195,12 +195,19 @@ _DEFUN (__eucjp_wctomb, (r, s, wchar, charset, state), if (char1 != 0x00) { /* first byte is non-zero..validate multi-byte char */ - if (_iseucjp (char1) && _iseucjp (char2)) + if (_iseucjp1 (char1) && _iseucjp2 (char2)) { *s++ = (char)char1; *s = (char)char2; return 2; } + else if (_iseucjp2 (char1) && _iseucjp2 (char2 | 0x80)) + { + *s++ = (char)0x8f; + *s++ = (char)char1; + *s = (char)(char2 | 0x80); + return 3; + } else { r->_errno = EILSEQ; -- cgit v1.2.3