develooper Front page | perl.perl5.porters | Postings from June 2008

[ #36817] Incomplete documentation of CGI::charset

Crawford Currie via RT
June 17, 2008 06:57
[ #36817] Incomplete documentation of CGI::charset
Message ID:
Tue Jun 17 09:56:16 2008: Request 36817 was acted upon.
Transaction: Ticket created by CDOT
     Subject: Incomplete documentation of CGI::charset
   Broken in: 3.29
    Severity: Normal
       Owner: Nobody
      Status: new
 Ticket <URL: >

Trap for the unwary.

When CGI::charset is called from a query object (e.g. $query->charset)
then there is an undocumented side effect; the encoding of text
parameters changes. For example, if you do this:

use CGI;
my $query = new CGI({ text => [ Encode::encode_utf8(chr(8192)) ]});
print $query->param('text');

then you will get a UTF8-encoded byte string printed. If however you call


instead of CGI::charset you will get a unicode string instead, resulting
in a 'Wide character in print' error.

This behaviour is acceptable, but needs to be documented in the man page. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About