缺点是什么在Windows中不使用统一code? [英] What are the disadvantages to not using Unicode in Windows?

查看:104
本文介绍了缺点是什么在Windows中不使用统一code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么缺点不使用Windows的Uni code?

What are the disadvantages to not using Unicode on Windows?

尤尼code,我的意思是 WCHAR 和广泛的API函数。 (CreateWindowW,MessageBoxW,等等)

By Unicode, I mean WCHAR and the wide API functions. (CreateWindowW, MessageBoxW, and so on)

我可以不使用此遇到了什么问题?

What problems could I run into by not using this?

推荐答案

您code将无法与系统API 1 <时务请用当前选定的codePAGE之外的字符正确对待/ SUP>。

Your code won't be able to deal correctly with characters outside the currently selected codepage when dealing with system APIs1.

典型的问题包括不支持的字符被转换为问号,无法处理有特殊字符的文本,特别是文件,它们的名称/路径奇怪的字符。

Typical problems include unsupported characters being translated to question marks, inability to process text with special characters, in particular files with "strange characters" in their names/paths.

此外,一些新的API是present仅在宽的版本。

Also, several newer APIs are present only in the "wide" version.

最后,涉及文本每个API调用会稍微慢一些,因为 A 的API的版本都是围绕通常只是薄包装的是W 的API,该参数转换为UTF-16的飞行 - 所以,你必须对于一些开销,一个普通是W 呼叫。

Finally, each API call involving text will be marginally slower, since the "A" versions of APIs are normally just thin wrappers around the "W" APIs, that convert the parameters to UTF-16 on the fly - so, you have some overhead in respect to a "plain" W call.


  1. 没有什么阻止你在一个狭窄的字符统一code编码工作(=> UTF-8)你的应用程序中,但Windows A 的API < A HREF =htt​​p://stackoverflow.com/questions/166503/utf-8-in-windows>不讲UTF-8 的,所以你必须转换为UTF-16和呼叫在是W 版本反正。

  1. Nothing stops you to work in a narrow-characters Unicode encoding (=>UTF-8) inside your application, but Windows "A" APIs don't speak UTF-8, so you'd have to convert to UTF-16 and call the W versions anyway.

这篇关于缺点是什么在Windows中不使用统一code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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