I have non-ascii characters with utf-8 encoding (Chinese characters), but they're not printed correctly. I have to add decode('utf8', $str) (in controller or template file) to get the right output. How could I set the template to recognize utf-8 string?

Anyhow, the literal stashed string can make the rigth output, and I don't know why. The content are stored in MySQL with utf-8 collection. I added $DB->do("SET NAMES 'UTF8'"); after database is connected, but no effect.

有帮助吗?

解决方案

try DBI option mysql_enable_utf8 set to 1.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top