Commit 67bfe42d authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(string_char_to_byte): Handle invalid multibyte sequence

correctly.
(string_byte_to_char): Likesize.
parent 040272ce
......@@ -845,7 +845,7 @@ string_char_to_byte (string, char_index)
while (best_above_byte > 0
&& !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte]))
best_above_byte--;
if (XSTRING (string)->data[best_above_byte] < 0x80)
if (!BASE_LEADING_CODE_P (XSTRING (string)->data[best_above_byte]))
best_above_byte = best_above_byte_saved;
best_above--;
}
......@@ -911,7 +911,7 @@ string_byte_to_char (string, byte_index)
while (best_above_byte > 0
&& !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte]))
best_above_byte--;
if (XSTRING (string)->data[best_above_byte] < 0x80)
if (!BASE_LEADING_CODE_P (XSTRING (string)->data[best_above_byte]))
best_above_byte = best_above_byte_saved;
best_above--;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment