Posts Tagged ‘utf-8’

Where to Set $xoops_charset

Monday, March 24th, 2008

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.

联通消失了

Wednesday, March 19th, 2008

先跟我做个实验:如果你用的是中文windows,运行记事本,输入“联通”两个字不要带引号,任取文件名保存,再打开,你会发现联通消失了,留下一个小方块。

拿这个例子来解释utf-8真是形象生动——因为记事本保存一份新建文档时的默认编码为ANSI,中文windows下就是GB2312,“联通”按GB2312保存为4个字节,头三个字节凑巧为utf-8编码文档开头的特征码byte order mark(BOM),所以记事本再次打开这个文件时,认定该文档是经utf-8编码,于是直接显示了第4个字节,那就是个小方块。

我不是第一个做这个实验的人,不过我跟开这个玩笑的人有着同样的感觉:联通确实不是个好名字,永远不能起头,所以永远被移动压着打。

如果非要联通起头后而不变成小方块,那么选择文档保存编码为非ANSI,可是大部分人不知道。

WP Shopping Cart Not Support utf-8

Sunday, December 30th, 2007

Recommended by WordPress, I installed one of business blogging plugin - WP Shopping Cart. Although I don’t think it’s a good idea to sell anything on this blog, I wanna try the plugin by categorising under WP Shopping Cart my investigation to hundred brands in Bicester Village.

To my disappointment, this plugin (ver 3.6 beta 7) does not support utf-8. I have to leave the plugin there. I don’t wanna do modification to this plugin by myself.