[Catalyst] HTML::Widget and locale problems

Andreas Marienborg omega at palle.net
Sat May 20 20:05:18 CEST 2006


Its a problem with HTML::Element.

if you look at the source, there is an _escape__xxx something method

its too greedy, this works for me:
sub _xml_escape {  # DESTRUCTIVE (a.k.a. "in-place")
   foreach my $x (@_) {
       $x =~ s~([<&>])~'&#'.(ord($1)).';'~seg;
   }
   return;
}


andreas


On 20. mai. 2006, at 19.48, fonseka at gmail.com wrote:

> Hi there!
>
> I'm fetching data from a DBIC Pg UTF-8 DB, and constructing
> HTML::Widget objects directly with the data I got from the DB.
>
> I used dumps in the middle of the code, and the data cames correctly
> with all my locale characters (I'm portuguese).
>
> But then, when I print the form using result.as_xml, the locale data
> becames escaped :(
>
> So instead of "Número" in the XHTML source i got "N&#195;&#186;mero".
>
> I tried playing with C::P::Unicode and with content-encoding, but
> nothing helps...
>
> Can you help me?? Is there a way to HTML::Widget don't escape my
> locale characters??
>
> -- 
> Will work for bandwidth
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst




More information about the Catalyst mailing list