cocos2dx中文顯示

 

在解決了中文顯示亂碼的問題之後,仍然有很多的問題需要我們解決。

char * G2U(const char* gb2312){
 int len = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);    
 wchar_t* wstr = new wchar_t[len+1];    
 memset(wstr, 0, len+1);    
 MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wstr, len);    
 len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);    
 char* str = new char[len+1];    
 memset(str, 0, len+1);    
 WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);    
 if(wstr) delete[] wstr;    
 return str;

}

這是win32的解決方案其實網上還有很多關於win32的中文解決方案。

還有一種方案是直接修改VS2012(我用的是vs2012)的編碼方式

144821125.png

144824295.png

144827635.png

選擇你模擬器支持的編碼格式,編碼時直接輸入中文即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章