From 721cdd300bf15938f0b825913f6c2a663744a09b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 16 Jul 2006 12:49:46 +0000 Subject: [PATCH] fix bytes->string/utf-8 when permissive char is NUL svn: r3724 --- collects/tests/mzscheme/unicode.ss | 2 ++ src/mzscheme/src/string.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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;