The data I'm working with will all be UTF-8, if that makes a difference.
Make sure it's decoded using one or more of the following
use utf8; # Treat the source code as UTF-8
use open ':std', ':locale'; # Treat STD* as per locale
use open ':std', ':encoding(UTF-8)'; # Treat STD* as UTF-8
use open IO => ':encoding(UTF-8)'; # Treat files as UTF-8 by default
open(my $fh, '<:encoding(UTF-8)', $qfn) # Treat a file as UTF-8
utf8::decode(my $text = $encoded_text) # Treat a string as UTF-8
And make sure the string us stored internally as UTF-8.
utf8::upgrade($s); # Use UNICODE semantics
(No need to do use utf8; to use utf8:: functions. use utf8; means the source is in UTF-8.)
If you do those two things, regexp will use UNICODE semantics, so \w and character classes will match accented letters, etc.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||