Re: comparing binary strings
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Tue, 11 Dec 2007 02:49:14 +0100
Joost Diepenmaat schreef:
Ben Morrow:
Joost Diepenmaat:
Ben Morrow:
You can't. You need to perform *the comparisons* under 'use bytes'.
No, you don't need to. The only time the encoding of the strings is
important is when you're passing them to external code as a C-style
char* pointer. Or at least it should be.
I agree, it should be; it's not, however. For instance, under 5.8.8,
a string containing "\xc1" (capital A acute) will match /\w/ if it is
utf8-encoded and not if its not. I'm not sure if this is fixed in
5.10; I'm not sure, either, what the correct fix would be.
Hm... You're right. That's not good, and arguably a bug (and with some
heavy backward-compatibility considerations). It doesn't say anything
about binary strings, though.
"\xA0" is whitespace in iso-8859-1:
perl -wle'
print 0+/^[\s\w]/
for "\xC1",
"\xC1\x{100}",
"\xA0",
"\xA0\x{100}",
substr("\xA0\x{100}", 0, 1),
'
0
1
0
1
1
--
Affijn, Ruud
"Gewoon is een tijger."
.
- Follow-Ups:
- Re: comparing binary strings
- From: Ben Morrow
- Re: comparing binary strings
- References:
- comparing binary strings
- From: Yakov
- Re: comparing binary strings
- From: Ben Morrow
- Re: comparing binary strings
- From: Joost Diepenmaat
- Re: comparing binary strings
- From: Ben Morrow
- Re: comparing binary strings
- From: Joost Diepenmaat
- comparing binary strings
- Prev by Date: Re: comparing binary strings
- Next by Date: FAQ 4.56 What happens if I add or remove keys from a hash while iterating over it?
- Previous by thread: Re: comparing binary strings
- Next by thread: Re: comparing binary strings
- Index(es):
Relevant Pages
|