summaryrefslogtreecommitdiff
path: root/console
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-10 12:05:06 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-10 12:05:06 +0000
commit5fe2b9242a4518cc957b3ccb955dfee3172245e5 (patch)
tree438cdffe4365b5a40275f447bfc457b020271b96 /console
parent80a243f5e1ce1a023cb45c6ecfa9ccc2b83312d7 (diff)
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')
-rw-r--r--console/ChangeLog6
-rw-r--r--console/display.c13
2 files changed, 17 insertions, 2 deletions
diff --git a/console/ChangeLog b/console/ChangeLog
index a7c8ca7d..bfa7eb14 100644
--- a/console/ChangeLog
+++ b/console/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2002-08-30 Marcus Brinkmann <marcus@gnu.org>
* display.c (display_create): Likewise. Set
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;