In a Webapp I maintain I try to keep everything in UTF-8:
- the Database (CHARSET=utf8)
- the source files (use utf8; written in utf8)
- the templates (for Template Toolkit, using ENCODING => utf8)
- user input and output (charset=utf8 header in HTTP, binmode :utf8 for STDIN and STDOUT)
But I still need to use Encode::decode('UTF-8',$data) for data coming from the database, or they will get double encoded or somehow broken.
Why is this? How can I get rid of this annoying extra step? Shouldn't there a way to just keep everything, everytime in UTF-8 without having to convert anything by hand?