xbmc 解决中文乱码问题

来源:互联网 发布:java简单的登录界面 编辑:程序博客网 时间:2024/05/17 21:16

 难以想像xbmc默认的source会出现中文显示乱码的问题, 还是花了一点小时间研究了一下这个问题,解决方法总结如下:


1. 替换字体文件

从windows下拷贝arial.ttf 文件覆盖 media/Font/ariail.ttf, 

 use any true-type font file you like to overwrite arial.ttf, and set the default Font setting to Arial. in GUI:

System->apperance-> Font


2.  modify the toUTF8 convert function

CStdString CLocalizeStrings::ToUTF8(const CStdString& strEncoding, const CStdString& str)
{
  if (strEncoding.IsEmpty())
    return str;

  CStdString ret;
  g_charsetConverter.unknownToUTF8( str, ret);
  // g_charsetConverter.stringCharsetToUtf8(strEncoding, str, ret);
  return ret;
}

3. some addon charset is still in bad charset.

I found, the bad charset display incorrect even I open it with vim. So, i convert the file by iconv

iconv -t utf-8 <file>

take youku: default.py as a example

iconv -f gb2312 -t utf-8  default.py


至此, 文件名,目录名, addon菜单,均可以显示正常了。