Firefox 中不显示阿拉伯文脚本语言

Arabic Script Language Not Displaying In Firefox

这是我写的代码:

<div id="testdiv" style="position:absolute; top:250; left:10; width:1200; height:200; border:solid 2px #005050;">
    <span style="direction:rtl; font-family:jameel noori nastaleeq;">دی گئی مساوات کو دیکھئے</span>
</div>

我没有在 部分指定任何相关方向,我的代码也没有任何 标签。

在firefox中,上面代码的运行结果是这样的:

而在 Chrome 中,相同的代码显示此结果:

Chrome 中的结果是应该的。我不知道为什么 Firefox 突然这样了。

我在这里做错了什么以及如何修复它以便 Firefox 中的结果与 Chrome 中的结果相匹配。

万一有人想知道文字的意思,它说:看看给定的等式。语言是乌尔都语。

页面完整源代码贴如下:

<html>
<head>
    <title>MathJax Test</title>
    <script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-MML-AM_CHTML">
    </script>

    <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
        tex2jax: {inlineMath: [['$','$'], ['\(','\)']]}
        });
    </script>
</head>

<body>
<canvas id="test" width="500" height="200" style="border:solid 2px #000000;"></canvas>

<div id="testdiv" style="position:absolute; top:250; left:10; width:1200; height:200; border:solid 2px #005050;">
    <span style="direction:rtl; font-family:jameel noori nastaleeq;">دی گئی مساوات کو دیکھئے</span>

</div>
</body>
</html>

您没有指定编码。如果依赖默认值,这些值可能不正确。

服务器应发送正确的 Content-Type header:

Content-Type: text/html; charset=utf-8

如果没有(或者不涉及服务器),您可以在 HTML 本身中模拟它:

  • HTML5

    <meta charset="utf-8">
    
  • 早期版本:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    

用实际编码替换 UTF-8(尽管在 2020 年推荐的编码是 UTF-8)。