Subject: Re: perl@7078
Message-Id: <
200009142109.RAA03425@leggy.zk3.dec.com>
p4raw-id: //depot/perl@7085
{
if (SvPOK(sv) && SvUTF8(sv)) {
char *c = SvPVX(sv);
- STRLEN len = SvCUR(sv);
+ STRLEN len = SvCUR(sv) + 1; /* include trailing NUL */
if (!utf8_to_bytes((U8*)c, &len)) {
if (fail_ok)
return FALSE;
Perl_croak("big byte");
}
SvCUR(sv) = len - 1;
+ SvUTF8_off(sv);
}
return TRUE;
}
/* ensure valid UTF8 and chars < 256 before updating string */
while (s < send) {
U8 c = *s++;
- if ( (s >= send) || (*s & 0x80 && c > 0xc3)) {
+ if (c >= 0x80 &&
+ ( (s >= send) || ((*s++ & 0xc0) != 0x80) || ((c & 0xfe) != 0xc2))) {
*len = -1;
return 0;
}