[Catalyst] utf8 in regexes in Catalyst

Alexandre Jousset mid at gtmp.org
Sun Mar 2 15:39:16 GMT 2008


	Hello Yves,

demerphq a écrit :
>>         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.

	How can I make sure my pattern is utf8 since it is just /\w/ ?

	My string is utf8, it comes from an utf8 form. But maybe it is not 
really? How Perl/Catalyst treats data that come from a form?

> 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.

	OK for this.

	Thanks,
-- 
--      \^/                                            --
--    -/ O \---------------------------------------    --
--   | |/ \|      Alexandre (Midnite) Jousset      |   --
--    -|___|---------------------------------------    --



More information about the Catalyst mailing list