diff --git a/collects/tests/mzscheme/unicode.ss b/collects/tests/mzscheme/unicode.ss index 631801280b..c811f45bcf 100644 --- a/collects/tests/mzscheme/unicode.ss +++ b/collects/tests/mzscheme/unicode.ss @@ -1036,6 +1036,8 @@ (test '(#o302 #o251) bytes->list (unicode-vector->bytes (vector 169))) (test '(#o304 #o250) bytes->list (unicode-vector->bytes (vector 296))) +(test "a\0b" bytes->string/utf-8 #"a\xFFb" (integer->char 0)) + (test '("\uA9") regexp-match #rx"." "\uA9") (test '(#"\302") regexp-match #rx#"." #"\302\251") (test '(#"\302") regexp-match #rx#"." "\uA9") diff --git a/src/mzscheme/src/string.c b/src/mzscheme/src/string.c index 5b98d21cf4..194ecc9129 100644 --- a/src/mzscheme/src/string.c +++ b/src/mzscheme/src/string.c @@ -1104,7 +1104,7 @@ do_byte_string_to_char_string(const char *who, NULL, 0, (perm > -1) ? 0xD800 : 0); - if (perm > 0) { + if (perm > -1) { for (i = 0; i < ulen; i++) { if (v[i] == 0xD800) v[i] = perm;