John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
This program
tells me "Malformed UTF-8 character (unexpected non-continuation byte 0x00 after start byte 0xc0) in pattern match (m//)"use utf8; chr(192) =~ /\w/;
As documented in perlfunc, chr seems to take Unicode characters just fine, producing legal UTF-8 for most values, but for some reason is working wrong for arguments in the range 191 through 255.
Here is more proof:
gives me:foreach (90, 192, 257, 0x263a) { print "$_ - ", join ('.',unpack('C*', +chr($_))),"\n" }
90 - 90 192 - 192 257 - 196.129 9786 - 226.152.186Note that 192 maps to a single 192 byte, not 195.128.
What's up?
—John
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re: problem with chr function
by tye (Sage) on Oct 25, 2002 at 20:23 UTC | |
by John M. Dlugosz (Monsignor) on Oct 25, 2002 at 21:48 UTC | |
Re: problem with chr function
by fglock (Vicar) on Oct 25, 2002 at 18:53 UTC | |
by John M. Dlugosz (Monsignor) on Oct 25, 2002 at 19:01 UTC | |
P.S. It's AS build 633 (Re: problem with chr function)
by John M. Dlugosz (Monsignor) on Oct 25, 2002 at 18:52 UTC | |
Re: problem with chr function
by Arrowhead (Monk) on Oct 26, 2002 at 16:36 UTC |
Back to
Seekers of Perl Wisdom