复制和粘贴时撇号会发生变化
当我在程序(即 notepad2、notepad++、hiedisql、word 等)和所见即所得的程序和源代码之间剪切和粘贴撇号时,我的撇号发生了一些变化。根据复制源和粘贴源的不同,它的外观和行为也有所不同。
这是正常的吗?有什么方法可以确保所有内容都以相同的方式呈现撇号?这是 Windows 的事情吗?
我觉得这是一个新事物,但也许一直都是这样。
When I cut and paste apostrophes between programs (ie. notepad2, notepad++, hiedisql, word, etc etc) and wysiwyg's, and source codes my apostrophe is changing a little. It looks different and it behaves differently depending on the copy source and paste source.
Is this normal? Is there any way to make sure everything renders the apostrophe the same way? is this a windows thing?
I feel like this is a new thing, but maybe it has always been like this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的意思是 ' -- 应该看起来像: -- 变成 ' ??
如果是这样,您的编辑器程序将“有帮助”地将非 Ascii 右撇号更改为 Ascii 中唯一可用的撇号,即“直”撇号:'(反之亦然。)
右撇号和左撇号在 Unicode 和 ISO 中定义8859 个字符集,但不是 Ascii。
解决方案检查编辑者的文档,看看是否可以关闭该行为。根据特定的编辑软件及其版本,可能无法实现。
已添加 即使 Stack Overflow 中的这个编辑器也给我带来了一些问题:我输入了 Unicode 右撇号,它在编辑器中看起来很好。但是预览窗口(以及我的答案的显示)将撇号显示为“直”撇号:Chrome 用于显示和预览答案的字体似乎显示了直撇号而不是右撇号。所以我为右撇号添加了一个图形。
关于该问题的博客文章
用于编写软件、SQL、等等,你应该坚持使用直撇号。编辑者不应将直撇号转换为右撇号。单引号(撇号)和直引号与左引号和右引号的问题是文档编辑器和代码(软件)编辑器之间的主要区别。如果您的编辑器为您更改了撇号和引号,则可能会导致您的软件出现很多问题。您通常可以关闭“智能引号”或类似行为。
Do you mean that ’ -- should look like: -- turns into ' ??
If so, your editor program is "helpfully" changing a non-Ascii right apostrophe into the only apostrophe available in Ascii, the "straight" apostrophe: ' (Or vice-versa.)
The right and left apostrophes are defined in Unicode and ISO 8859 character sets, but not Ascii.
Solution Check the docs for your editors to see if you can turn off the behavior. It may not be possible depending on the specific editing software and its version.
Added Even this editor in Stack Overflow caused me some problems: I entered the Unicode right apostrophe, and it looked fine in the editor. But the preview window (and the display of my answer) shows the apostrophe as being a "straight" apostrophe: it appears that the font used by Chrome for displaying and previewing the answer shows a straight apostrophe instead of a right one. So I added a graphic for the right apostrophe.
Blog post about the problem
For writing software, SQL, etc, you should stick to the straight apostrophe. Editors should not convert the straight apostrophe to the right apostrophe. The issues of single quotes (apostrophes) and straight quotes vs opening and closing quotes is a primary difference between a document editor and a code (software) editor. If your editor changes apostrophes and quotes for you, it can cause a lot of problems in your software. You can usually turn off the behavior of "smart quotes" or similar.
好吧,这是一个非常疯狂但有效且简单的方法来解决这个问题。我正在使用 Python 写一个“选择你自己的冒险”故事,我也遇到了同样的问题。如果我从我喜欢的编辑器“Scrivener”中复制并粘贴,然后将其粘贴到 txt 文档中或通过 VS Code 粘贴到该 txt 文档中,则撇号将不是那种 ASCII 样式,并且会在输出中打印为奇数字母。
我的解决方案如图所示:我选择“查找”,然后将撇号粘贴到我的文字处理程序(我不想要的那个)中,让它找到所有内容,然后,我点击向下箭头,然后输入程序接受的“'”撇号,然后单击“替换全部”。
这仍然是一个不光彩的、停滞不前的问题,但这个方法对我有用。
我的意思的屏幕截图
Okay so here's a really crazy but effective and simple way to fix the problem. I'm writing a "Choose Your Own Adventure" story using Python and I was having the same problem. If I copied and pasted out of my preferred editor "Scrivener", and pasted it into a txt doc or through VS Code into that txt doc, the apostrophes wouldn't be that ASCII style and it would print as odd letters in the output.
My solution is as pictured: I selected "Find" and I pasted in the apostrophe form my word processor (The one I don't want) and had it find all, and then, I hit the down arrow, and just typed in the "'" apostrophize that the program accepts, and then hit REPLACE ALL.
This is still an ignoble, stagnant problem to have, but this method worked for me.
Screen Grab of What I Mean Here
似乎有两种形式的 ASCII,一种是有限的,然后是一种你知道的进化形式,它成为 Unicode 8 和 16 之间的区别,这只是我的猜测,但我很抱歉我可以进一步帮助你
It seems like there's two forms of ASCII there's a finite and then there's an evolved form you know which becomes the difference between Unicode 8 and 16 that's just my guess but I'm so sorry I can help you farther