[Catalyst] IO::Handle Wide character in syswrite

Matthew Lawrence matthew.lawrence at ehsbrann.com
Tue Sep 27 11:39:49 CEST 2005


Bernard FRIT wrote:
> 2005/9/26, Matthew Lawrence <matthew.lawrence at ehsbrann.com 
> <mailto:matthew.lawrence at ehsbrann.com>>:
> 
>     Bernard FRIT wrote:
>      > Hi everybody,
>      >
>      > [ ... ]
>      >
>      > Wide character in syswrite at
>      > /usr/lib/perl5/5.8.7/i686-linux/IO/Handle.pm line 449.
>      >
> 
>     You normally see that message when you're writing unicode data to a
>     handle that isn't set up to receive it.
> 
>     You'll probably need to specify the ":utf8" layer on the handle
>     concerned.
> 
> This problem ony appears when using Locale::Currency::Format to display 
> correct EURO formatting within pages. As I'm currently connecting to an 
> existing mysql database I only found one way to display columns with 
> accented chars : removing charset information from http headers
> 
> $c->res->content_encoding('');

It would be well worth trying to establish what character set the data 
from the database comes back in, converting to unicode if necessary. See 
the standard module Encode for details about converting between 
charsets. Locale::Currency::Format seems to produce unicode, so if your 
database doesn't, you'll end up outputting a page in mixed encoding, 
which may well be your problem.

> 
> Does it make sense with the IO::Handle problem ?

I'm not sure. It looks like the Catalyst::Engine::HTTP::Daemon module is 
generating this warning. It doesn't have a binmode statement in it, so 
it should be using the default encoding for its handles. Try adding "use 
open ':utf8';" nice and early in your main module. Or set the 
PERL_UNICODE environment variable to 24 or 31. Search for PERL_UNICODE 
in man perlrun for details.

hope this helps

Matt




More information about the Catalyst mailing list