有人说:Sqlite默认是UTF-8
读出数据后,再用MultiByteToWideChar把它转成Unicode...下面是我弄的
这是我的代码:
int size= WideCharToMultiByte(CP_ACP,0,q.fieldValue(3),-1, NULL, 0, NULL,0);
char * AsciiBuff =new char[size];
WideCharToMultiByte(CP_ACP,0,q.fieldValue(3),-1,AsciiBuff,size, NULL,0);
//q.fieldValue(3)是取出的数据是unsigned short类型,我先转成了char*,下面是再转成Unicode
DWORD dwNum = MultiByteToWideChar (CP_UTF8, 0, AsciiBuff, -1, NULL, 0);
wchar_t *pwText;
pwText = new wchar_t[dwNum];
MultiByteToWideChar (CP_UTF8, 0, AsciiBuff, -1, (LPWSTR)pwText, dwNum);
我试了不行,大家看看代码,请大家指出问题在哪里?
谢谢!!