[Catalyst] UTF-16 surrogate message when writing binary data(image)

Ash Berlin ash_cpan at firemirror.com
Mon May 19 12:41:43 BST 2008


On 19 May 2008, at 12:34, Martin Ellison wrote:

> I've finally had the opportunity to test my code a bit more. The  
> $pic_image is a string of some kind and not a file handle.
>
> Also I tried doing binmode STDOUT but this fails --  the binmode  
> call returns false.
>
> There could be any binary data in my string, so any UTF-8-bad byte  
> pairs are definitely possible. I would think the solution is to  
> inform Catalyst that the data is not UTF-8 but binary. In the normal  
> case of writing to a file, one can use binmode to tell perl that the  
> data is binary but that does not work here.
>
> Is this a gap in the Catalyst API?

Are you by any chance setting a header to something with UTF8 content?

I had a problem similar to this that was caused by me setting a  
Content-Disposition header to something including unicode.

-ash



More information about the Catalyst mailing list