If you don't have "use utf8" anywhere in the script, then there is probably something in your environment that is setting locale in such a way to make Perl assume that "use utf8" ought to be in effect.
Anyway, if you put "no utf8" in the script, the problem should go away. Alternately, if you assign that string of single-byte accented characters to a scalar, and use the Encode::decode() method to create a utf8 version of the string, you should then be able to use the utf8 string in the regex:
update: Of sourse, you would only use the decode approach if the data to be tested against the regex are in utf8 now, or if you want to make sure to produce utf8 output from the data (in the latter case, input data that happens to be single-byte would need to be decoded as well, before hitting it with the utf8 version of the regex). If the input is still single-byte, and you still want the output to be single-byte, just say "no utf8".use Encode; ... my $s = 'äöüÄÖÜß'; my $u = decode('latin1', $s); my $patternWUmlauts=qr/[\w$u]+/; ...
In reply to Re: legacy code, utf8 and Perl 5.8.0
by graff
in thread legacy code, utf8 and Perl 5.8.0
by barrachois
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |