[cgiapp] Re: peer review request for UTF patch: "Stray UTF8 bit on
headers infects the whole output"
Mark Stosberg
mark at summersault.com
Mon Jul 6 12:17:03 EDT 2009
> Mark Stosberg wrote:
> > Could someone who is more UTF-8 savvy than myself peer review this simple UTF-8
> > patch for CGI::Application for me?
> >
> > http://rt.cpan.org/Public/Bug/Display.html?id=46513
> >
> > You can comment through the ticket or here.
> >
> > Mark
> >
>
> You may find this thread on perlmonks relevant:
> http://www.perlmonks.org/index.pl?node_id=683833
>
> It also implies that the patch should probably test for the existence of the
> utf8::downgrade function (for older perls).
>
> My personal opinion: this patch is probably a good idea (given that LWP does
> something similar), even though I have never had an issue with utf8 headers
> myself (and I do output quite a bit of utf8 content). I'm by no means an
> expert on encodings, but I do trust Juerds expertise on this subject (he's the
> author of perlunitut).
So, the original patch loooked like this:
+ utf8::downgrade($headers, 1);
Based on Perlmonks thread, are you suggesting an updated patch should
look like this? :
+ *_utf8_downgrade = defined(&utf8::downgrade)
+ ? sub { utf8::downgrade($_[0], 1) or Carp::croak("content must be bytes") }
+ : sub { }
+ ;
+ _utf8_downgrade($headers, 1);
Mark
More information about the cgiapp
mailing list