# HG changeset patch # User Kenichi Handa # Date 895830267 0 # Node ID 3eedfddbbadd6f4bc338f680718370c0d1706ef6 # Parent 8075f717f3e43fac49ce0dc3dcd5b640ab530319 (print_string): Don't ignore garbage bytes following a multibyte characters. (print): Likewise. diff -r 8075f717f3e4 -r 3eedfddbbadd src/print.c --- a/src/print.c Fri May 22 06:29:05 1998 +0000 +++ b/src/print.c Fri May 22 09:44:27 1998 +0000 @@ -589,8 +589,8 @@ /* Here, we must convert each multi-byte form to the corresponding character code before handing it to PRINTCHAR. */ int len; - int ch = STRING_CHAR_AND_LENGTH (XSTRING (string)->data + i, - size_byte - i, len); + int ch = STRING_CHAR_AND_CHAR_LENGTH (XSTRING (string)->data + i, + size_byte - i, len); PRINTCHAR (ch); i += len; @@ -1188,6 +1188,7 @@ register int i, i_byte; register unsigned char c; struct gcpro gcpro1; + unsigned char *str; int size_byte; /* 1 means we must ensure that the next character we output cannot be taken as part of a hex character escape. */ @@ -1204,6 +1205,7 @@ #endif PRINTCHAR ('\"'); + str = XSTRING (obj)->data; size_byte = STRING_BYTES (XSTRING (obj)); for (i = 0, i_byte = 0; i_byte < size_byte;) @@ -1214,9 +1216,13 @@ int c; if (STRING_MULTIBYTE (obj)) - FETCH_STRING_CHAR_ADVANCE (c, obj, i, i_byte); + { + c = STRING_CHAR_AND_CHAR_LENGTH (str + i_byte, + size_byte - i_byte, len); + i_byte += len; + } else - c = XSTRING (obj)->data[i_byte++]; + c = str[i_byte++]; QUIT;