perl-unicode

Re: Another Unicode s/// buglet?

2002-06-26 10:30:06
On Wed, Jun 26, 2002 at 05:52:25PM +0100, Hugo van der Sanden wrote:
I wrote:
:Attached patch passes all existing tests here, as well as some new ones.

Whoops, crossed in the post. My patch was written against @17356;
it may not be necessary after #17358, but the extra tests might be
worth keeping.

I notice that you've used this code:
    SV *nsv = newSVpvn(c, clen);

#17362 adds sv_2mortal() here.

    if (PL_encoding)
        sv_recode_to_utf8(nsv, PL_encoding);
    else
        sv_utf8_upgrade(nsv);

Should I be using the same approach in regexec.c:S_to_utf8_substr()
and S_to_byte_substr()? They currently don't know about PL_encoding.

Probably.  The PL_encoding is the encoding pragma that'll cause
upgrading to Unicode to assume some other character set than Latin 1
(which sv_utf8_upgrade assumes).

Also, does your version need the additional
    SvSetMagicSV(nsv, dstr)

Probably.  I'll try whether it disturbs anything, I guess no since
we'd need some magical Unicode string?

that I borrowed from there in my version of the patch?

Hugo

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

<Prev in Thread] Current Thread [Next in Thread>