[Catalyst] unicode best practices

Richard Jolly richardjolly at mac.com
Sat Feb 17 21:22:10 GMT 2007


On 16 Feb 2007, at 15:58, Richard Jolly wrote:

To reply to myself...

> Jonathan Rockway wrote:
>
>> Also, read http://www.catalystframework.org/calendar/2006/21
>> for unicode details.

Thanks again for this.

> The encoding::warnings pragma is great, though I'm a little shocked at
> how many warnings it's uncovered.
>
> Other questions: C::P::Unicode encodes the body in the finalize method.
> That makes sense.

It only handles text* content types. I had to patch it to handle the 
application/xml we produce.

The main surprise (at least to me) was that POSTed content (not from a 
from a form, but in a ReSTy style) comes in as a File::Temp object, so 
I had to make sure that was explicitly encoded as well. 
Catalyst::Plugin::Unicode handles most parameters, but not that.

> But I'm tempted to try putting "use encoding 'utf8'" in the main
> catalyst application module. Or at least "use open 'utf8'". That would
> handle all the file reads and writes, but presumably also the final
> write to STDOUT that catalyst does. So it sounds like it would conflict
> with C::P::Unicode.

I didn't end up doing this. Instead I just attacked all inputs and 
outputs and made sure they were handled explicitly.

Thanks for everyone's help.

Richard




More information about the Catalyst mailing list