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: 27104
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: md [...] bts.sk
Cc:
AdminCc:

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



Subject: param not working with UTF-8
Date: Sat, 12 May 2007 14:27:11 +0200
To: bug-CGI.pm [...] rt.cpan.org
From: Marian Ďurkovič <md [...] bts.sk>
Download (untitled) / with headers
text/plain 1.3k
Hi, seems that due to bugreport #19913 a new code was introduced into param, which automatically calls decode if UTF-8 is being used. However this has bad conseqeunces and breaks some applications - like openwebmail. The problem is, that lot of perl fucntions don't accept wide characters (md5, zlib, etc). While the original UTF-8 string passes through them fine, after decode they all complain with e.g. Wide character in subroutine entry at /usr/lib/perl5/site_perl/5.8.8/IO/Compress/Adapter/Deflate.pm line 43 The attached patch against CGI.pm v3.25 solves the problem and makes e.g. openwebmail work again. With kind regards, M. -------------------------------------------------------------------------- ---- ---- Show quoted text
---- Marian Ďurkovič network manager ---- ---- ---- ---- Slovak Technical University Tel: +421 2 524 51 301 ---- ---- Computer Centre, Nám. Slobody 17 Fax: +421 2 524 94 351 ---- ---- 812 43 Bratislava, Slovak Republic E-mail/sip: md@bts.sk ---- ---- ---- --------------------------------------------------------------------------
Download CGI.diff
text/x-diff 557b

Message body is not shown because sender requested not to inline it.

Download (untitled) / with headers
text/plain 487b
A related issue: it seems that if cgi's charset is set to utf-8, then character retrieved with param() are converted to UTF8, but when they're set in they're not converted back. This program shows the behavior: #!/usr/bin/perl -w use strict; use CGI; use utf8; my $cgi = new CGI(); $cgi->charset( "utf-8" ); $cgi->param("euro", "â¬" ); # option-shift 2 on a mac, the euro symbol. my $euro = $cgi->param("euro"); print "Euro: $euro\n"; $cgi->param("euro", $euro);
Download (untitled) / with headers
text/plain 660b
A related issue: it seems that if CGI's charset is set to utf-8, then characters retrieved with param() are converted to UTF8, but when they're put back they're not converted back from UTF8 into a bytestring. This program shows the behavior: #!/usr/bin/perl -w use strict; use CGI; use utf8; my $cgi = new CGI(); $cgi->charset( "utf-8" ); $cgi->param("euro", "â¬" ); # option-shift 2 on a mac, the euro symbol. # (not sure right char is above, but that's the char I discovered the # issue with in my system) my $euro = $cgi->param("euro"); print "Euro: $euro\n"; $cgi->param("euro", $euro); # this line causes the wide char error
Download (untitled) / with headers
text/plain 848b
On Tue Jun 05 20:57:25 2007, JOSHR wrote: Show quoted text
> A related issue: > > it seems that if CGI's charset is set to utf-8, then characters > retrieved with param() are converted to UTF8, but when they're put back > they're not converted back from UTF8 into a bytestring. This program > shows the behavior: > > #!/usr/bin/perl -w > use strict; > > use CGI; > use utf8; > my $cgi = new CGI(); > $cgi->charset( "utf-8" ); > $cgi->param("euro", "â¬" ); > # option-shift 2 on a mac, the euro symbol. > # (not sure right char is above, but that's the char I discovered the > # issue with in my system) > > my $euro = $cgi->param("euro"); > > print "Euro: $euro\n"; > > $cgi->param("euro", $euro); # this line causes the wide char error
This appears to be resolved by CGI.pm 3.43. The above test script no longer triggers an error.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.