in reply to Re^2: CGI hidden params vs. character encoding
in thread CGI hidden params vs. character encoding
it worked. How strange...
I found it strange too. I just clued in what the error is.
First of all,
binmode STDOUT, ':utf-8';
is a no-op, since there's no "utf-8" layer.
>perl -le"print binmode(STDERR, ':utf8')?1:0" 1 >perl -le"print binmode(STDERR, ':utf-8')?1:0" 0 >perl -le"print binmode(STDERR, ':encoding(utf8)')?1:0" 1 >perl -le"print binmode(STDERR, ':encoding(utf-8)')?1:0" 1
If we do it properly (:encoding(utf-8)) we end up with your orignal problem.
Your problem is that you are double-encoding! You're telling CGI to encode your data using UTF8 (-charset => 'utf-8') and then you encode it again using binmode STDOUT, ":utf8";.
The solution is to get rid of binmode completely and only use CGI's methods to output.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: CGI hidden params vs. character encoding
by graff (Chancellor) on May 28, 2008 at 00:41 UTC | |
by ikegami (Patriarch) on May 28, 2008 at 01:24 UTC |