如何解决汉字乱码的问题!

类别:软件工程 点击:0 评论:0 推荐:
由于SymbianOS操作系统用的是统一的Unicode,所以我们把资源文件改为中文后会出现乱码,但我们如何解决呢?

其实很简单,我们只要把资源文件中的中文用Word或IE等转换成UTF8,再加上CHARACTER_SET UTF8 就OK了,如下:

-----------------原代码如下:----------------
#include
#include "my.hrh"
#include "my.loc"
#include
#include
#include
RESOURCE CBA r_softkeys_Login_Exit
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyLogin;
txt = "登录";
},
CBA_BUTTON
{
id = EAknSoftkeyBack;
txt = "退出";
}
};
}


-------------转换之后:--------------
CHARACTER_SET UTF8
NAME AWIZ
// INCLUDES

#include
#include "my.hrh"
#include "my.loc"
#include
#include
#include
RESOURCE CBA r_softkeys_Login_Exit
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyLogin;
txt = "鐧诲綍"; //UTF8
},
CBA_BUTTON
{
id = EAknSoftkeyBack;
txt = "閫€鍑?; //UTF8
}
};
}
由于SymbianOS操作系统用的是统一的Unicode,所以我们把资源文件改为中文后会出现乱码,但我们如何解决呢?

其实很简单,我们只要把资源文件中的中文用Word或IE等转换成UTF8,再加上CHARACTER_SET UTF8 就OK了,如下:

-----------------原代码如下:----------------
#include
#include "my.hrh"
#include "my.loc"
#include
#include
#include
RESOURCE CBA r_softkeys_Login_Exit
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyLogin;
txt = "登录";
},
CBA_BUTTON
{
id = EAknSoftkeyBack;
txt = "退出";
}
};
}


-------------转换之后:--------------
CHARACTER_SET UTF8
NAME AWIZ
// INCLUDES

#include
#include "my.hrh"
#include "my.loc"
#include
#include
#include
RESOURCE CBA r_softkeys_Login_Exit
{
buttons =
{
CBA_BUTTON
{
id = EAknSoftkeyLogin;
txt = "鐧诲綍"; //UTF8
},
CBA_BUTTON
{
id = EAknSoftkeyBack;
txt = "閫€鍑?; //UTF8
}
};
}

本文地址:http://com.8s8s.com/it/it31967.htm