Did not get that has_utf8/this_utf8 fix right last time, another spot
Nick Ing-Simmons [Sat, 9 Dec 2000 19:26:37 +0000 (19:26 +0000)]
was only testing this_utf8.

p4raw-id: //depot/perlio@8053

toke.c

diff --git a/toke.c b/toke.c
index 5106744..d8ffc1e 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1313,11 +1313,12 @@ S_scan_const(pTHX_ char *start)
 
        /* (now in tr/// code again) */
 
-       if (*s & 0x80 && this_utf8) {
-           STRLEN len;
+       if (*s & 0x80 && (this_utf8 || has_utf8)) {
+           STRLEN len = (STRLEN) -1;
            UV uv;
-
-           uv = utf8_to_uv((U8*)s, send - s, &len, UTF8_CHECK_ONLY);
+           if (this_utf8) {
+               uv = utf8_to_uv((U8*)s, send - s, &len, UTF8_CHECK_ONLY);
+           }
            if (len == (STRLEN)-1) {
                /* Illegal UTF8 (a high-bit byte), make it valid. */
                char *old_pvx = SvPVX(sv);