Search code examples
smartyshift-jis

Smarty - Shift-jis encoding without using PHP


I want to show Shift-jis characters but only when displaying it. Store in UTF-8 and show in Shift-jis, so what is the solution to do that in Smarty?


Solution

  • You cannot mix different charsets/encodings in the output to the browser. So you can either send UTF-8 OR Shift-jis.

    You can use UTF-8 internally and in an outputfilter convert the complete output from UTF-8 to Shift-jis (using mb_convert_encoding).

    Smarty is not (really) equipped to deal with charsets other than ASCII supersets (like Latin1, UTF-8) internally.