summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/print.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c
index ec340e2c91d..3723c79b6dd 100644
--- a/src/print.c
+++ b/src/print.c
@@ -635,7 +635,11 @@ print_string (string, printcharfun)
int len;
int ch = STRING_CHAR_AND_CHAR_LENGTH (XSTRING (string)->data + i,
size_byte - i, len);
-
+ if (!CHAR_VALID_P (ch, 0))
+ {
+ ch = XSTRING (string)->data[i];
+ len = 1;
+ }
PRINTCHAR (ch);
i += len;
}
@@ -1266,7 +1270,10 @@ print (obj, printcharfun, escapeflag)
{
c = STRING_CHAR_AND_CHAR_LENGTH (str + i_byte,
size_byte - i_byte, len);
- i_byte += len;
+ if (CHAR_VALID_P (c, 0))
+ i_byte += len;
+ else
+ c = str[i_byte++];
}
else
c = str[i_byte++];