From: Roca, Ignasi Date: Fri, 5 Jan 2001 12:28:52 +0000 (+0100) Subject: strings with \x{..} in the middle are corrupted X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=65e2654b3cf08ae676040518f84657b8a84698e3;p=p5sagit%2Fp5-mst-13.2.git strings with \x{..} in the middle are corrupted Message-ID: <5930DC161690D211966700902715754703738F96@madt009a.siemens.es> UTF-8 parsing fix that seems to be needed for EBCDIC, in ASCII no effect. (changed the strncpy() to Copy()) p4raw-id: //depot/perl@8329 --- diff --git a/toke.c b/toke.c index 850d913..9b23896 100644 --- a/toke.c +++ b/toke.c @@ -1414,6 +1414,8 @@ S_scan_const(pTHX_ char *start) if (hicount) { char *old_pvx = SvPVX(sv); char *src, *dst; + U8 tmpbuf[UTF8_MAXLEN+1]; + U8 *tmpend; d = SvGROW(sv, SvCUR(sv) + hicount + 1) + (d - old_pvx); src = d - 1; @@ -1422,9 +1424,10 @@ S_scan_const(pTHX_ char *start) while (src < dst) { if (UTF8_IS_CONTINUED(*src)) { - dst--; - uv_to_utf8((U8*)dst, (U8)*src--); - dst--; + tmpend = uv_to_utf8(tmpbuf, (U8)*src--); + dst -= tmpend - tmpbuf; + Copy((char *)tmpbuf, dst+1, + tmpend - tmpbuf, char); } else { *dst-- = *src--;