windows 右单撇号与撇号?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6711892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Right single apostrophe vs. apostrophe?
提问by TripShock
Right single quotation mark (U+2019) vs. Apostrophe (U+0027)
右单引号 (U+2019) 与撇号 (U+0027)
What is the difference between these two characters?
这两个字符有什么区别?
I ran into this issue where I use CAtlString to load a string from a resource file, and on some Windows installations, the LoadString fails when trying to load a string that contains U+2019, but it works on some other Windows installations. The U+2019 character appears in strings in my resource file that I copied from Word, and U+0027 appears in stirngs that I hand coded. Why does LoadString (sometimes) choke on this?
我遇到了这个问题,我使用 CAtlString 从资源文件加载字符串,在某些 Windows 安装中,LoadString 在尝试加载包含 U+2019 的字符串时失败,但它适用于其他一些 Windows 安装。U+2019 字符出现在我从 Word 复制的资源文件中的字符串中,而 U+0027 出现在我手工编码的字符串中。为什么 LoadString(有时)会因此而窒息?
回答by bobince
What is the difference between these two characters?
这两个字符有什么区别?
Arguable!
有争议!
Going by the names, one would imagine that the curly ?'? is only for use as a quotation mark, and that the straight ?'? is only for use as a real apostrophe, an indicator of omitted letters.
顾名思义,人们会想象那卷曲的 ?'? 仅用作引号,而直的 ?'? 仅用作真正的撇号,省略字母的指示符。
However traditional typesetting practice in English is always to use a curly ?'? to render an apostrophe. Personally—and I may be alone here—I don't like this. It can make for more ambiguous reading:
然而,传统的英语排版习惯总是使用卷曲的 ?'? 呈现撇号。就个人而言——我可能一个人在这里——我不喜欢这样。它可以使阅读更加模棱两可:
“He said, ‘It's fish 'n' chips'...”
“他说,‘这是鱼和薯条’……”
with the apostrophes being straight it's (marginally) clearer where the quotation ends:
撇号是直的,引用结束的地方(稍微)更清楚:
“He said, ‘It's fish 'n' chips'...”
“他说,‘这是鱼和薯条’……”
and the apostrophe being ‘straight' makes more sense to me because its purpose of indicating omitted letters has no inherent directionality, whereas quotation marks are clearly asymmetrical in purpose.
撇号是“直的”对我来说更有意义,因为它表示省略字母的目的没有固有的方向性,而引号的目的显然是不对称的。
In traditional ASCII, of course, there are no smart quotes, so the apostrophe is always used for both...
在传统的 ASCII 中,当然,没有智能引号,所以撇号总是用于两者......
on some Windows installations, the LoadString fails when trying to load a string that contains U+2019, but it works on some other Windows installations.
在某些 Windows 安装中,LoadString 在尝试加载包含 U+2019 的字符串时失败,但它适用于其他一些 Windows 安装。
Here you are meeting the horror of the ‘ANSI' code page. This is a default character encoding that is different across different Windows install locales. So on a machine in the Western region, you get different results when you read a resource to when you read it on a Japanese Windows.
在这里,您遇到了“ANSI”代码页的可怕之处。这是默认的字符编码,在不同的 Windows 安装区域设置中是不同的。因此,在西部地区的机器上,读取资源与在日语 Windows 上读取资源时得到的结果不同。
It is highly unfortunate that Windows has varying default code pages instead of using a single global encoding like UTF-8, but it's too late to fix now. If you compile your whole application as a Unicode app (so you'll be using LoadStringW
rather than LoadStringA
) then you can cope with non-ASCII characters like the smart quotes much better.
非常不幸的是,Windows 具有不同的默认代码页,而不是使用像 UTF-8 这样的单一全局编码,但现在修复为时已晚。如果您将整个应用程序编译为 Unicode 应用程序(因此您将使用LoadStringW
而不是LoadStringA
),那么您可以更好地处理非 ASCII 字符,例如智能引号。
If you can't move to a Unicode application you're a bit stuck. You won't be able to handle non-ASCII characters like the smart quotes globally, so stick with ASCII characters like the straight apostrophe ?'? alone.
如果您无法移动到 Unicode 应用程序,那么您就会陷入困境。您将无法在全局范围内处理智能引号等非 ASCII 字符,因此请坚持使用 ASCII 字符,例如直撇号 ?'? 独自的。
The U+2019 character appears in strings in my resource file that I copied from Word
U+2019 字符出现在我从 Word 复制的资源文件中的字符串中
Yes, Word has an annoying AutoCorrect feature that replaces all apostrophes you type with smart quotes. This is especially undesirable when you are dealing with code, where ?'? will break the program; but it's also wrong even for plain old English, as it's not possible to correctly guess the desired direction of the quote. (It'll get one of the apostrophes in “fish 'n' chips” the wrong way round, for example.)
是的,Word 有一个令人讨厌的自动更正功能,可以用智能引号替换您键入的所有撇号。这在您处理代码时尤其不可取,在哪里?'?会破坏程序;但即使对于简单的古英语也是错误的,因为不可能正确猜测引用的所需方向。(例如,它会以错误的方式获得“fish 'n'chips”中的一个撇号。)
I suggest turning off the automatic-replace-with-smart-quotes feature. If you want the smart quotes, it's better to type them deliberately. Unfortunately they are inconvenient to type on most keyboard layouts, often requiring obscure Alt+numpad sequences. Personally I use this oneto drop them onto Alt+[] keys.
我建议关闭自动替换智能引号功能。如果您想要智能引号,最好是故意输入它们。不幸的是,它们不方便在大多数键盘布局上键入,通常需要模糊的 Alt+小键盘序列。我个人使用这个将它们放到 Alt+[] 键上。
回答by MRAB
Historically, single-quote and double-quote come in pairs, left (open) and right (close).
历史上,单引号和双引号成对出现,左(开)和右(关)。
For many years the character sets of computers were limited, having a single form of each.
多年来,计算机的字符集是有限的,每个字符集只有一种形式。
Now, with the advent of Unicode, the full forms are available, but support for them is still limited. Programming languages still use the simple forms, and the full forms can still cause problems.
现在,随着 Unicode 的出现,可以使用完整的形式,但对它们的支持仍然有限。编程语言仍然使用简单的形式,而完整的形式仍然会导致问题。