Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 36817
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: cpan [...] c-dot.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Incomplete documentation of CGI::charset
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)) ]}); CGI::charset('utf-8'); print $query->param('text'); then you will get a UTF8-encoded byte string printed. If however you call $query->charset('utf-8'); 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.
On Tue Jun 17 09:56:16 2008, CDOT wrote: Show quoted text
> 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)) ]}); > CGI::charset('utf-8'); > print $query->param('text'); > > then you will get a UTF8-encoded byte string printed. If however you call > > $query->charset('utf-8'); > > 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.
I tested both the reported variations with 3.43. Neither returned the error you mentioned-- they both printed the same thing. I'm assuming this has been fixed you reported it. Please re-open if there still seems to be an issue.