如何告诉 Firefox 忽略不可打印的字符?

Bri*_*anH 5 firefox special-characters

编辑:总结

显然,在这种情况下显示的预期字符是“破折号”。

此页面中间有一个表格,显示对于–,某些软件会将 2013 的正确十六进制代码转换为 0096。(查看表格中的第一行)。

Stackoverflow 上的这个答案解释说,不知何故,这是 Windows-1252 和 UTF-8 之间的混淆

这篇博客文章强制执行:

字符 150 (0x96) 是未显示的 C1 控制字符范围中的 Unicode 字符“START OF GUARDED AREA”,但在 Windows-1252 编码中,它被映射到可显示字符 0x2013“en-dash”(短划线) .

其他人在制作内容时一直在努力解决这个问题,因为Stackoverflow 上的这个答案显示了如何用 0x2013 替换 0x0096。

谷歌必须意识到这一点,因为正如我在下面的原始问题中所述,谷歌的亚马逊页面缓存版本–似乎在他们缓存的页面上自动纠正这些错误。

我曾尝试将我的编码设置为 Windows-1252,但这无济于事。

所以现在我想我的问题是,如何告诉 Firefox 忽略这些不可打印的字符?


原文内容如下:


(Windows XP 上的 Firefox 3.6.13)

浏览网页时,我每隔一段时间就会在某些网页上发现一个奇怪的字符。它是一个盒子的轮廓,里面有一个 4 位数字。

具有这些字符的页面示例是:http : //aws.amazon.com/ec2/#highlights

在每个部分标题(弹性,完全控制,...)之后,我会看到一个里面有数字“0096”的框。我在谷歌上查看了缓存版本,谷歌已经–在它的位置,所以我猜我应该在那里看到一个破折号而不是带有数字的框。

我曾尝试在 Firefox 中更改字符编码,但无法找到正确显示这些字符的编码。

有没有办法让 Firefox 查看这些字符?

提前致谢!

编辑 - 添加“特殊”字符的屏幕截图:

替代文字

编辑 #2 - 在 Ubuntu 中尝试过 - 新截图

我登录到我的 Ubuntu 桌面并在 Chrome 和 Firefox 中浏览到亚马逊页面。Chrome 完全忽略字符,即使我检查或查看页面源。Unbutu 中的 Firefox 显示的字符与我的 Windows XP 盒子上的 Firefox 完全一样。我复制了这个角色并在命令行中使用它 - 这是结果的屏幕截图:

替代文字

看起来我也可以将角色粘贴到这篇文章中:``

它绝对不是孤立于 Windows XP 的。我尝试将我的终端的字符编码设置为 Windows 1252(来自下面丹尼斯的评论),但它只是将此字符显示为问号。

我用 wget 和 curl 拉下网页,两个输出都显示这个字符: <96>

这让我想知道这个角色是否适合任何人?看起来 webkit 只是忽略它,我的 IE6 忽略它,Firefox 显示带有数字的框。我不得不想象亚马逊的设计团队可以正确地看到它吗?

让这些字符正确显示并不是什么大问题,但很高兴知道是否有解决方案。

Aar*_*ver 0

0096 很可能是对 ' char 的 ASCII 引用,可以在 HTML 中显示为&#96;

查看您的链接,但 HTML 看起来很正常,并且没有参考&ndash;

...

<p><span class="product_highlights">Elastic</span>  Amazon <span class="caps">EC2</span> enables you to increase or decrease capacity within minutes, not hours or days. You can commission one, hundreds or even thousands of server instances simultaneously. Of course, because this is all controlled with web service APIs, your application can automatically scale itself up and down depending on its needs.</p> 


    <p><span class="product_highlights">Completely Controlled</span>  You have complete control of your instances. You have root access to each one, and you can interact with them as you would any machine. You can stop your instance while retaining the data on your boot partition and then subsequently restart the same instance using web service APIs. Instances can be rebooted remotely using web service APIs. You also have access to console output of your instances.</p> 


    <p><span class="product_highlights">Flexible</span>  You have the choice of multiple instance types, operating systems, and software packages.  Amazon <span class="caps">EC2</span> allows you to select a configuration of memory, <span class="caps">CPU</span>, instance storage, and the boot partition size that is optimal for your choice of operating system and application.  For example, your choice of operating systems includes numerous Linux distributions, Microsoft Windows Server and OpenSolaris.</p> 

...
Run Code Online (Sandbox Code Playgroud)

Firefox 显示破折号字形应该没有问题,因为我刚刚在 3.6.* 上进行了测试...

<html>
    <head>
        <body>
            My dash is &ndash;
        </body>
    </head>
</html>
Run Code Online (Sandbox Code Playgroud)

...将上述代码复制并粘贴到测试文档中,并将其命名为 test.html 并在 Firefox 中打开它。它应该毫无问题地显示您的破折号。

编辑:正如戴夫所指出的,0x96 是破折号的 ANSI 等效项。根据这种理解,这似乎是关于页面本身内的文档类型规范的解析问题。查看此线程

您可以提取 HTML 并修改文档类型,看看这是否确实是问题的根源。它很可能是编码值之间的交叉,即...ANSI -> Unicode;作为 Unicode,该值是不可打印的字符。