|P is for Practical|
Confusing UTF-8 bug in CGI-scriptby wanradt (Scribe)
|on Feb 01, 2011 at 15:16 UTC||Need Help??|
wanradt has asked for the
wisdom of the Perl Monks concerning the following question:
I wrote a simple web script to add some (UTF-8 encoded) texts into database. Somehow is there a bug which i can't find. I simplified it to bones and it still does not work.
When i enter plain ascii, it is OK. When i enter Latin1 diacritics like "öä", they turn out like "��". When i try use somethin outside of Latin1, it turns to "Internal server error" and from log i see: "Cannot decode string with wide characters at /usr/lib/perl/5.10/Encode.pm line 162."
As far as i see, i have data properly encoded and headers define charset right way. I put test ( is_utf8() ) in script and it yells "1" to log. So where is the glitch here?