简体   繁体   English

非unicode程序的语言会更改ini阅读

[英]Language for non-unicode programs change ini reading

I've a non-unicode application which is using unicode versions of the ini reading functions like GetPrivateProfileSectionW and GetPrivateProfileStringW. 我有一个非unicode应用程序,它正在使用ini读取功能的unicode版本,例如GetPrivateProfileSectionW和GetPrivateProfileStringW。 The program is working well when "Language for non-unicode programs" is set to English. 当“非unicode程序的语言”设置为英语时,该程序运行良好。

When I change this setting to Chinese (PRC), the functions GetPrivateProfileSectionW and GetPrivateProfileStringW return null. 当我将此设置更改为中文(PRC)时,函数GetPrivateProfileSectionW和GetPrivateProfileStringW返回空值。

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. 我必须将此设置保持为中文,因为当为“非unicode程序的语言”选择英语时,CComBSTR.LoadString无法按预期工作,它将中文字符加载到资源DLL中作为问号。

Any ideas? 有任何想法吗?

Thanks. 谢谢。

Michael Kaplan explains . 迈克尔·卡普兰(Michael Kaplan) 解释说 The solution is to use Unicode INI files, which don't depend on the "Language for non-unicode programs". 解决方案是使用Unicode INI文件,该文件不依赖于“非unicode程序的语言”。

The "Language for non-Unicode programs" also selects the default code page used for files. “非Unicode程序的语言”还选择用于文件的默认代码页。 US English is usually Windows-1252. 美国英语通常为Windows-1252。 Chinese will be something different, like GB2312 or GBK. 中文会有所不同,例如GB2312或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. 使用记事本打开.INI文件,并以“ ANSI”格式保存该文件,这将是Microsoft对于所选非Unicode语言的默认设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM