develooper Front page | perl.perl5.porters | Postings from June 2002

Re: Another Unicode s/// buglet?

Thread Previous | Thread Next
Jarkko Hietaniemi
June 26, 2002 10:03
Re: Another Unicode s/// buglet?
Message ID:
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++; #
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About