develooper Front page | perl.perl5.porters | Postings from November 2010

Re: "perl: utf8.c:1997: Perl_swash_fetch: Assertion `klen <= sizeof(PL_last_swash_key)' failed." [5.12.1]

Thread Previous | Thread Next
Tom Christiansen
November 27, 2010 06:31
Re: "perl: utf8.c:1997: Perl_swash_fetch: Assertion `klen <= sizeof(PL_last_swash_key)' failed." [5.12.1]
Message ID:
> What is this code trying to do? It's not obvious to me.

Sorry, Nick.  It's trying to get $_ to hold a fully Unicode-
enabled character for purposes of pattern matches against it.
I need \s \w etc to work correctly on it, including across the
problematic Latin1 range of 128..255.

>>         # fixes "the Unicode bug"
>>         unless (utf8::is_utf8($_)) {
>>             $_ = decode("iso-8859-1", $_);
>>         }

> And (unless I'm missing something) the code as-is *isn't*
> flipping the internal flag, so there's no way it can leave
> internal structures in an inconsistent state.

I misunderstood what was being discussed.  I thought it was all utf8::
functions, including even is_utf8, but rereading it appears that it's the
underbarred _utf8_on and _utf8_off functions that are the problem, where
people go flipping the utf8 bit no matter what the contents really are.
I knew that those would do me no good here.

I'm glad to learn that I'm actually playing by the rules.


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