The
locale pragma does not change the behavior of character
classes like
[a-z0-9,:;"' ] in regular expressions.
If you want to get the accents as expected you should
be able to use something
like
[[:lower:]0-9:;"' ] instead. These
are described in
perlre. Search for "POSIX character class".
update:
I should clarify that POSIX character classes aren't the
only way locales are supported in regex's character classes,
of course. As chromatic says, the reason that yours
didn't work is because you enumerated a-z
explictly. As long as you aren't using explict ranges like that including
accented characters, etc. won't be a problem; things like
\w work as expected under use locale.
(Why aren't you using or die ... on
the second open there? Also, perl lets you use / instead of \\ for things
like open.
)
Please
turn on perl's features to help you.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.