in reply to Confusing UTF-8 bug in CGI-script
The problem is that you are decoding STDIN (via use open), and STDIN is used to transfer something that isn't text. The solution is to add
binmode(STDIN);
CGI (the protocol) uses STDIN to pass on the document sent in POST requests. In this case, it's an application/x-www-form-urlencoded document.
Then, CGI (the module) parses that document and decodes the extracted text components.
Encode (used by CGI) detects (correctly guesses) that something's wrong and fails with
Cannot decode string with wide characters
Don't decode non-text. Other processing (decoding of "%" escapes) needs to be done before you have the text that needs to be decoded.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confusing UTF-8 bug in CGI-script
by wanradt (Scribe) on Feb 01, 2011 at 20:14 UTC | |
by ikegami (Patriarch) on Feb 01, 2011 at 20:50 UTC | |
by wanradt (Scribe) on Feb 01, 2011 at 21:13 UTC | |
by wanradt (Scribe) on Feb 01, 2011 at 20:27 UTC | |
by ikegami (Patriarch) on Feb 01, 2011 at 20:55 UTC |