开发者

Language for non-unicode programs change ini reading

开发者 https://www.devze.com 2023-03-06 01:53 出处:网络
I\'ve a non-unicode application which is using unicode versions of the ini reading functions like GetPri开发者_运维百科vateProfileSectionW and GetPrivateProfileStringW. The program is working well whe

I've a non-unicode application which is using unicode versions of the ini reading functions like GetPri开发者_运维百科vateProfileSectionW and GetPrivateProfileStringW. The program is working well when "Language for non-unicode programs" is set to English.

When I change this setting to Chinese (PRC), the functions GetPrivateProfileSectionW and GetPrivateProfileStringW return null.

I must keep this setting at Chinese, because when English is selected for "Language for non-unicode programs", CComBSTR.LoadString is not working as expected, it loads the Chinese characters in a resource DLL as question marks.

Any ideas?

Thanks.


Michael Kaplan explains. The solution is to use Unicode INI files, which don't depend on the "Language for non-unicode programs".


The "Language for non-Unicode programs" also selects the default code page used for files. US English is usually Windows-1252. Chinese will be something different, like GB2312 or GBK. Open your .INI file with Notepad and save it with the "ANSI" format, which will be whatever Microsoft's default for the non-Unicode language selected.

0

精彩评论

暂无评论...
验证码 换一张
取 消