支持双字节unicode文件数据的选项有哪些? [英] What are the options for supporting double byte unicode file data?

查看:71
本文介绍了支持双字节unicode文件数据的选项有哪些?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:Windows 8(32位),Visual Studio 2012(Visual C ++)



我使用STLstring进行所有字符串操作以处理数据文件。现在,如果文件包含双字节Unicode字符,我需要在程序中进行哪些更改?只是使用Unicode编译器设置进行编译会将字符串更改为wstring,还是我必须将字符串更改为wstring,我处理多字节Unicode数据?



感谢您的回答提前。

Environment: Windows 8 (32 bit), Visual Studio 2012 (Visual C++)

I use STL "string" for all my string manipulations for processing data in the file. Now, if the file contains double byte Unicode characters, what changes do I need to make in my program? Will just compiling with Unicode compiler settings change string to "wstring" or do I have to change string to wstring everywhere I process multi byte Unicode data?

Thanks for your answer in advance.

推荐答案

您必须更改所有字符串 wstring <的引用/ code>。您还必须将所有 char 引用更改为 WCHAR ,并且(如有必要)添加 L 所有字符串常量的前缀。您可能希望阅读使用C / C ++处理简单文本文件 [ ^ ],其中包含有关在ASCII和Unicode之间转换文件内容的一些信息。
You have to change all your string references to wstring. You also have to change all char references to WCHAR, and (if necessary) add the L prefix to all string constants. You may like to read Handling simple text files in C/C++[^], which has some information about converting file content between ASCII and Unicode.


这篇关于支持双字节unicode文件数据的选项有哪些?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆