note
ikegami
<blockquote><p><i>The data I'm working with will all be UTF-8, if that makes a difference. </i></blockquote>
<p>Make sure it's decoded using one or more of the following
<c>
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
or die;
</c>
<p>And make sure the string us stored internally as UTF-8.
<c>
utf8::upgrade($s); # Use UNICODE semantics
</c>
<p>(No need to do <c>use utf8;</c> to use <c>utf8::</c> functions. <c>use utf8;</c> means the source is in UTF-8.)
<p>If you do those two things, regexp will use UNICODE semantics, so <c>\w</c> and character classes will match accented letters, etc.
735804
735804