Day: March 24, 2008

  • Where to Set $xoops_charset

    I prefer UTF-8, always.

    I am sorry to see Xoops new release is by default still ISO-8859-1 encoded. Unfortunately, Xoops have not provided a complete reference book for all smarty tags. I struggled to change the charset.

    First, I looked at theme.html, and found it is

    <meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>" />

    instread of

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />

    Although I could erase “<{$xoops_charset}>” and put in “UTF-8”, I knew it was not the best way to change the default encoding.

    So I began to search for where the smarty tag $xoops_charset is saved. I thought Xoops the adminstration interface had a place to change the charset. I went through each field in Site Preferences and found nowhere to set the charset.

    It becomes a guess work for me where which value was stored. I searched the database but I could not find any value is “ISO-8859-1”.

    Last method I used was a global search for the string “ISO-8859-1” in all Xoops source files. 16 hits. “/language/english/global.php” was likely to affect $xoops_charset. I opened it and changed a line from

    define('_CHARSET', 'UTF-8');

    to

    define('_CHARSET', 'UTF-8');

    Then, UTF-8 encoding is successfully changed.