moodel日历显示乱码的解决办法
作者:小刚 日期:2010-03-09
前两天帮一个同学弄一个moodel平台,弄好后安装中文语言包后,日历部分显示为乱码,经过分析,自己发现一个可以解决的办法,希望能为遇到此类问题的博友提供参考。
首先,我谷歌一下,原来很多人也有这种问题,解决办法是将\lang\zh_cn_utf8下的langconfig.php的文件格式由utf-8改为ANSI格式,改完后日历部分的乱码是正常了,但是语言选项下拉列表的“简体中文”却变成乱码。有点顾此失彼的味道。于是我想能不能只改日历的编码呢。于是还是不变文件本身的编码,只是在文件中将日历的年月等相关的变量的编码用一个iconv的函数来改变编码。于是问题就解决了。最后的代码是
PHP代码
- <?php
- $string['alphabet'] = 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z';
- $string['backupnameformat'] = '%%Y%%m%%d-%%H%%M';
- $string['firstdayofweek'] = '1';
- $string['locale'] = 'zh_CN.UTF-8';
- $string['localewin'] = 'Chinese_China.936';
- $string['localewincharset'] = 'CP936';
- $string['nativecharset'] = 'GB18030';
- $string['nameedit'] = 'LF';
- $string['oldcharset'] = 'UTF-8';
- $string['strftimedate'] = iconv("utf-8", "gb2312//IGNORE",'%%Y年%%m月%%d日');
- $string['strftimedateshort'] = iconv("utf-8", "gb2312//IGNORE",'%%m月%%d日');
- $string['strftimedatetime'] = iconv("utf-8", "gb2312//IGNORE",'%%Y年%%m月%%d日 %%H:%%M');
- $string['strftimedaydate'] = iconv("utf-8", "gb2312//IGNORE",'%%Y年%%m月%%d日 %%A');
- $string['strftimedaydatetime'] = iconv("utf-8", "gb2312//IGNORE",'%%Y年%%m月%%d日 %%A %%H:%%M');
- $string['strftimedayshort'] = iconv("utf-8", "gb2312//IGNORE",'%%m月%%d日 %%A');
- $string['strftimedaytime'] = iconv("utf-8", "gb2312//IGNORE",'%%A %%H:%%M');
- $string['strftimemonthyear'] = iconv("utf-8", "gb2312//IGNORE",'%%Y年%%m月');
- $string['strftimerecent'] = iconv("utf-8", "gb2312//IGNORE",'%%m月%%d日 %%H:%%M');
- $string['strftimerecentfull'] = iconv("utf-8", "gb2312//IGNORE",'%%Y年%%m月%%d日 %%A %%H:%%M');
- $string['strftimetime'] = '%%H:%%M';
- $string['thischarset'] = 'UTF-8';
- $string['thisdirection'] = 'ltr';
- $string['thislanguage'] = '简体中文';
- ?>
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: