Hi All,
I made a small plugin that uses PHP’s iconv to convert from one encoding to another, eg UTF-8 to Shift-JIS. I needed this for the mobile section of a UTF-8-based Japanese website, as many Japanese cellphones only support Shift-JIS. I just wrapped the entire mobile template in this tag—it didn’t seem to make a noticeable speed difference. If anyone else out there is doing internationalization or localization this might help you.
Here are the docs:
Iconvify converts enclosed content from one text encoding to another using PHP’s iconv. This allows you to store data in your database using eg UTF-8, but still display it using a different encoding, such as Shift-JIS for Japanese mobile phones.
By default it converts from UTF-8 to Shift-JIS:
{exp:iconvify}
some UTF-8 text or tag output to convert to Shift-JIS
{/exp:iconvify}
You can override these using the parameters from=”” and/or to=”“:
{exp:iconvify to="iso-2022-jp"}
some UTF-8 text or tag output to convert to ISO-2022-jp
{/exp:iconvify}
When converting from UTF-8 to Shift-JIS it uses Nihonbunka’s tilde workaround (thanks!).
Please note that I haven’t yet used this in production (it worked fine in tests), and it’s my first plugin, so if you discover any problems or have suggestions please let me know. If the download link below doesn’t work, you can also grab it from here: oli-iconvify.0.1.zip
Changelog:
The Korean internet is 100% borked. 99.7% IE, active X (can’t do anything without it) - I have no idea about cellphones and encoding but I imagine they don’t use utf8 because in my experience Korea rarely follows internation standards but instead does there own thing due to extreme nationalism.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.