From 05e217ed7f1f34e3cfd26158161d5cfef9a86809 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 16 May 2017 19:38:10 -0700 Subject: [PATCH] Fix string-for-primitive as pointed out by Matt. --- src/runtime/ustring.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/ustring.scm b/src/runtime/ustring.scm index d0b54b951..2cada76b3 100644 --- a/src/runtime/ustring.scm +++ b/src/runtime/ustring.scm @@ -2065,12 +2065,12 @@ USA. (else (every-loop char-8-bit? ustring3-ref string start end)))))) (define (string-for-primitive string) - (if (and (not (slice? string)) + (if (and (or (legacy-string? string) + (and (ustring? string) + (fix:= 1 (ustring-cp-size string)))) (let ((end (string-length string))) - (case (ustring-cp-size string) - ((1) (every-loop char-ascii? ustring1-ref string 0 end)) - ((2) (every-loop char-ascii? ustring2-ref string 0 end)) - (else (every-loop char-ascii? ustring3-ref string 0 end))))) + (every-loop (lambda (cp) (fix:< cp #x80)) + cp1-ref string 0 end))) string (string->utf8 string))) -- 2.25.1