|laziness, impatience, and hubris|
I am almost sure I had this script working already. But yesterday I noted that when I call it with a URL with unicode characters (say, dic.pl?word=coração), I can't get this string correctly.
I am using 'use locale;' for Portuguese, I am using 'use utf8;' because the script has unicode characters, I am using 'binmode(STDIN,":utf8");' and 'binmode(STDOUT,":utf8");', and finally, I am calling the hader function for CGI with '-charset=>"utf-8"'.
Added as well the META tag in the HTML, and checked that apache doesn't have a default charset.
But the string appears in latin1 (with two different bytes for each unicode character.
Thanks for any hint.
Hack: noted that if I use Encode::_set_utf8 to the parameter, all seems to work. But it is a hack.