diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2002-09-10 12:05:06 +0000 |
---|---|---|
committer | Marcus Brinkmann <marcus@gnu.org> | 2002-09-10 12:05:06 +0000 |
commit | 5fe2b9242a4518cc957b3ccb955dfee3172245e5 (patch) | |
tree | 438cdffe4365b5a40275f447bfc457b020271b96 /console/display.c | |
parent | 80a243f5e1ce1a023cb45c6ecfa9ccc2b83312d7 (diff) | |
download | hurd-5fe2b9242a4518cc957b3ccb955dfee3172245e5.tar.gz hurd-5fe2b9242a4518cc957b3ccb955dfee3172245e5.tar.bz2 hurd-5fe2b9242a4518cc957b3ccb955dfee3172245e5.zip |
2002-09-10 Marcus Brinkmann <marcus@gnu.org>
* display.c (display_output_some): If iconv fails with EILSEQ,
skip the next byte in the buffer and print a replacement
character.
Diffstat (limited to 'console/display.c')
-rw-r--r-- | console/display.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/console/display.c b/console/display.c index 43e01e29..638ac222 100644 --- a/console/display.c +++ b/console/display.c @@ -1629,8 +1629,17 @@ display_output_some (display_t display, char **buffer, size_t *length) if (nconv == (size_t) -1) { - /* Conversion didn't work out. */ - if (saved_err == EINVAL) + /* Conversion is not completed, look for recoverable + errors. */ +#define UNICODE_REPLACEMENT_CHARACTER ((wchar_t) 0xfffd) + if (saved_err == EILSEQ) + { + assert (*length); + (*length)--; + (*buffer)++; + display_output_one (display, UNICODE_REPLACEMENT_CHARACTER); + } + else if (saved_err == EINVAL) /* This is only an unfinished byte sequence at the end of the input buffer. */ break; |