[Catalyst] UTF-16 surrogate warning under FastCGI

Jim Spath jspath at pangeamedia.com
Tue Jul 22 21:59:12 BST 2008

So I know the whole UTF-16 surrogate warning issue has been brought up a 
few times on this list, but I don't think anyone has posted a reliable 
test case, so I thought I would take a stab at it.  We have over 2700 of 
these warnings in todays error logs, so it'd be nice to get rid of them.

All that's really necessary is to reproduce the problem is to output a 
body of the necessary length:

   # 56338 = 0xdc12
   $c->response->body(1 x 56338);

And to run your application under FastCGI.  It will produce the 
following warning every time:

UTF-16 surrogate 0xdc12 at /usr/lib/perl/5.8/IO/Handle.pm line 199.

I've created a minimal Catalyst application to demonstrate the problem 
which can be downloaded here:


No plugins are used and binmode is not set.

Anyways, hopefully this makes it easier for people to figure out what is 
going on.

- Jim

More information about the Catalyst mailing list