Well, maybe the status of the utf8 flag on the regex could be irrelevant, but if the regex has characters in one encoding, and the string you apply it to is in some other encoding, there's no way it can work as intended.
I don't get it. I thought I said I normalize both to UTF8..? Okay, so I probably wasn't clear. If the following doesn't make clear why I'm confused, then I will just have to admit that I don't know what I'm doing at all...
# assume all encode/decode works correctly my $regexp_raw = "...."; my $regexp_utf8_decoded = decode($some_enc, $regex_raw); my $regexp_utf8_encoded = encode('utf8', $regexp_utf8_decoded); my $some_content = "..."; my $some_content_decoded = decode($some_enc, $some_content); my $some_content_encoded = encode('utf8', $some_content_decoded); $some_content_decoded =~ /$regexp_utf8_decded/; # matches correctly $some_content_decoded =~ /$regexp_utf8_encoded/; # matches correctly $some_content_encoded =~ /$regexp_utf8_decoded/; # no $some_content_encoded =~ /$regexp_utf8_encoded/; # no
So why doesn't $some_content_encoded match? I thought all strings are normalized to UTF8...
In reply to Re^4: Matching UTF8 Regexps
by lestrrat
in thread Matching UTF8 Regexps
by lestrrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |