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

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

谢谢!

...全文
309 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
  • 打赏
  • 举报
回复
对不起,贴错地方了

16,471

社区成员

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

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

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