[Catalyst] utf8 in regexes in Catalyst

demerphq demerphq at gmail.com
Sun Mar 2 13:27:44 GMT 2008


On 02/03/2008, Alexandre Jousset <mid at gtmp.org> wrote:
>         Hello list,
>
>         I'm able tu "use encoding utf8" in a normal Perl program to correctly
>  match regexes like this : echo 'é' | perl -e 'use encoding "utf8";print
>  <> =~ /\w/' (in an utf8 terminal), but how could I achieve the same
>  result in a Catalyst application? Am I obliged to "use encoding" in
>  every module? Is there a way to do it globally? What is the right way to
>  do this?
>
>         My goal is to check input from utf8 forms.

Make sure that your pattern and string are utf8 and you wont have
problems and will get faster runtimes.

All use encoding 'utf8' is doing in that example is forcing your input
and code to be interpreted as utf8. You could easily do the same thing
in many other ways in code. In fact its recommended you avoid use
encoding at all.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"



More information about the Catalyst mailing list