如何在当前的VC ++.net项目中支持Unicode? [英] How do I support Unicode in my current VC++.net project?
本文介绍了如何在当前的VC ++.net项目中支持Unicode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,我的项目是用Visual Studio 2010编写的VC ++.net.我需要在此项目中支持Unicode.我将项目属性(配置属性->字符集)从使用多字节字符集更改为使用Unicode字符集.然后,在构建时会出现很多错误.
Currently my project is VC++.net written in Visual studio 2010. I need to support Unicode in this project. I changed my project properties that is Configuration Properties->Character set from Use Multi-Byte Character Set to Use Unicode Character Set. Then when building, lot of errors is coming. Is there any other way to do this?
推荐答案
没有C ++.net这样的东西.如果这是".NET的C ++",请正确调用它:C ++/CLI.如果这确实是.NET,则没有非Unicode文本之类的东西.在.NET中,根据定义,所有字符串都是Unicode.如果使用非Unicode编码(例如System.Text.ASCIIEncoding
)序列化.NET字符串,则只能破坏它.不要这样做就可以了.
—SA
There is not such thing as C++.net. If this is "C++ for .NET", call it correctly: C++/CLI. If this is really .NET, there is no such thing as non-Unicode text. In .NET, all strings are Unicode by definition. You can only spoil it if you serialize the .NET string using non-Unicode encoding such asSystem.Text.ASCIIEncoding
. Don''t do it and be fine.
—SA
还将在项目属性的定义"部分中添加UNICODE和/或_UNICODE
您还必须修改代码,以用TCHAR(或类似的东西)替换char*
并使用unicode ready函数.
also add the UNICODE and/or _UNICODE in the "define" section of the project properties
You also will have to modify the code to replacechar*
with TCHAR (or seomthing like that) and use unicode ready functions.
您是在告诉我们整个故事吗?默认情况下,为Unicode配置新项目.
Are you telling us the whole story ? By default new projects are configured for Unicode.
这篇关于如何在当前的VC ++.net项目中支持Unicode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文