关于Unicode 和 MBCS的一个简单问题

boge 2000-03-03 08:48:00
加精
要编制国际化的软件,用Unicode 和 MBCS的方法都可以达到。
MSDN也说了如何用。但是,在选择两者之一时,有什么标准呢?
一般规范的程序,包括VC例子都提供了上述两种编译版本,那么,生成的执行程序
在应用范围上有什么区别呢?
是不是跟平台有关,如NT?

谢谢!

...全文
310 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lgzmlh 2000-10-25
  • 打赏
  • 举报
回复
These are my report about using Unicode, I'd like to have it shared with you, do please point out directly what's wrong or correct, hope to help you and me. thanks



The Different Support of Using Unicode on Win95, WinNT Win98, and Win2000

1. Win 95:

Advantage:
· Limited Unicode functionality
· Application based on Unicode can run on Win 95 only after some programming work for Translation.
· When application based on Unicode can run on Win 95, it can run all kinds versions of Windows OS.

Disadvantage:
· Processing default character set only, none internal support of Unicode.
· Programming for translating string parameters to local character sets each time before calling API function.
· None support of crossing language character input.
· Compared with on Win98 and WinNT, much more programming work will be needed.

Solution 1: Based on Win32 API
· Win 32 API contains wide data type support to allow Unicode compliance, call TxteOutW, ExtextOutW, GetCharWithW, GetTextExtentW, GetTextExtentPointW for handling Unicode.
· Call WideCharToMultiByte and MultiByteToWideChar for translation.
· Programming for using Active IMM (Active Input Method Manger) for crossing-language character input.

Solution 2: Based on MFC
· Using provided built-in support for Unicode, define _UNICODE macros to convert generic text to Unicode data types.
· Programming for using Active IMM crossing language character input.


2. Win NT

Advantage:
· Internal support for Unicode as well as for ANSI.
· Support two flavors of the Win32 API--'W' or wide character entry points, for string parameters encoded in Unicode, and 'A' or ANSI entry points, for string parameters encoded in local character sets. That means it is possible to design the application based on Unicode running on Win 95 as well as on Win NT, and the application based on ANSI running on Win 95 as well as on Win NT.
· Compared with Win95, Win98, it is easier to make application based on Unicode.


Disadvantage:
· Not all of user’s OS are Win NT.

Solution 1: Based on Win32 API
· Call the A entry points, Windows NT will automatically convert the string parameters into Unicode before calling the W version of the same function.

Solution 2: Based on MFC
· Same as it is talked on Win 95

3. Win 98

Advantage:

· Wide-byte support.
· Windows 98 has added support for a few more functions and there are techniques to implement additional Unicode support

Disadvantage:
· Win98 are not internally Unicode based.
· No support of crossing language character input.
· More programming work compared with Win NT.

Solution 1: Based on Win32 API
· Win 32 API contains wide data type support to allow Unicode compliance, call TxteOutW, ExtextOutW, GetCharWithW, GetTextExtentW, GetTextExtentPointW for handling Unicode.
· Programming for using Active IMM (Active Input Method Manger) for crossing-language character input.

Solution 2: Based on MFC
· Same as it is talked on Win 95



4. Win2000

Totally support Unicode. When application based on Unicode can run on Win95, Win98, WinNT, it do run on Win2000.


Deling 2000-03-06
  • 打赏
  • 举报
回复
最好是使你的source完全可以移植。以下是几条建议
1.定义所有的string的时候用_TEXT 宏
2.字符型数据用TCHAR,字符指针用LPTSTR
3.所有的字符串函数都用_tcs...宏,而不用str...函数
例如,用_tcscpy代替strcpy,用_stprintf 代替 sprintf

boge 2000-03-03
  • 打赏
  • 举报
回复
也就是说,如果你的程序要在windows和NT两个平台都支持的话,必须有两个版本?
unicode 版本难道不能在windows运行吗?
或者说unicode 版本的性能不如MBCS?
在WIN2000,应该用何版本?
littletao 2000-03-03
  • 打赏
  • 举报
回复
对,nt使用了unicode编码,而98是dbcs+sbcs。
softdoctor 2000-03-03
  • 打赏
  • 举报
回复
对不起,贴错地方了
v1.06 (20120410) FontMaker(点阵字库) 1. 增加系统字体支持,操作更简单,快捷。 v1.05 (20120324) FontMaker(点阵字库) 1. 修正了字符对齐问题。 2. 增加了单个字符或多个字符输出成位图文件设定。 3. 完善了阿拉伯文字库(unicode 字库有效)。 4. 增加自定义字符功能(unicode 字库有效)。 Multi-language(多国语言) 1. 增加输出编码格式 (mbcs, utf16-lb, utf8)设置 2. 增加数组格式输出。 Image Manager(图像管理) 1. 该页为新增功能,支持图片图像的数据转换。主要应用在做产品logo图片方面。 V1.04 (20110716) 1. 增加了一个字符串mbcs2unicode(内码转统一码)的功能。 (支持转:U16-LE, U16-BE, UTF8) V1.03 (20110705) 1. 修改了 Example 中点阵字库解析源码,更加便于移植。(基本做到只需修改font_file.c 即可) 2. 修改了内码(MBCS)字库点阵信息读取的一个错误。 3. 增加了多语言支持(简中,英文),还有待完善。。。 V1.02 (20110701) 1. FontMaker V2.03 a. 增加字符宽高比调节(HorR & VerR) b. 增加对*.ttc 字库的支持。 c. 增加bdf(*.bdf)文件格式转Simple Unicode编码格式的bin文件。 V1.01 (20110629) 1. FontMaker V2.02 a. 增加了 Simple Unicode功能。(适合小字库) b. 增加了 “扫描方向及反显”设置。 2. Multi-Language V1.01 a. 修改了除 office 2000 外,其它不能支持的问题。 V1.00: (20110627) 1. 继承 FontMaker V2.01 的所有功能。 2. 增加了一个 Multi-Languge V1.00 的打包转换功能。 FontMaker 基本功能: 1.支持所有 windows 字符集:CP932(日文Shift-JIS)CP936(简体中文GBK)CP949(韩文)CP950(繁体中文 Big5),CP874(泰文),CP1250(中欧)CP1251(西里尔文),CP1252(西欧--"拉丁文I"),CP1253(希腊文), CP1254(土耳其文),CP1255(希伯来文),CP1256(阿拉伯文),CP1257(波罗的海文),CP1258(越南) 2.支持非等宽字库。 3.支持BIN,TXT,BMP,BDF 文件输出。 4.支持unicode字库输出,即可以做到在一个窗口中同时显示多国语言(文字) 5.支持单个字符编辑,预览(所见即所得)。 6.支持字库文件和输出路径记忆功能 7. 支持从bdf格式转换自定义字库(bin文件)格式。
创建一个新的XML文档,分析修改现存的XML文档,所有的这些都中可以从一个利用MFC或STL字符串所实现的一个简单类的方法中得到。关于CMarkup,你可以运行Zip文件右边的例子,如果你愿意,你可以通过看源码,几分钟把它加入到你自己的应用中。 特征 Cmarkup是依据EDOM的,这是这个简单XML分析的关键。EDOM是操作XML元素、属性和数据的简明方法集。当你不需要复杂的XML特性时,它避免你读大量的DOM和SAX文档。 如果你希望使用微软的MSXML,CMarkup工程中CmarkupMSXML类全面的演示了通过EDOM来使用MSXML,并且它是以C++ COM语法开始。 下载包(看上面zip文件的链接)中包含了测试对话框工程的源码、Cmarkup类的所有测试和示例、以及编译选项。关于用在商业用途中的详细说明请看文章底部的在Licensing中的注意事项。 下面列出了CMarkup的特征: 独立:不需要任何外部的XML组件。 小:编译到你的工程只是很小的一个类,并且对于文档只维持了一个字符串,以及一个总计小于字符串内存大小的索引数组。 快:分析器在相当快的建立索引数组。 简单:EDOM方法使创建、导航和修改XML无比的简单。 MSXML:CMarkupMSXML类用EDOM方法包装了微软的XML服务。MSXML编译选项用来演示这个类。 UNICODE(统一字符编码标准):对于WindowsNT和WindowsCE平台能够被编译成UNICODE,在WindowsNT UNICODE下,XML文档是流到UTF-8文件中,但是内部用宽字符。 UTF-8:对于UTF-8文件,这接受和返回UTF-8字符串(确保_MBCS没有被定义) MBCS:对于双字节数据(定义_MBCS),它不与UTF-8兼容. STL:CMarkupSTL类完全没有使用MFC,它的演示要使用STL编译选项。

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧