summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/wctomb_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/wctomb_r.c')
-rw-r--r--newlib/libc/stdlib/wctomb_r.c9
1 files changed, 8 insertions, 1 deletions
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;