【问题标题】:How to show Unicode characters in a QTextBrowser?如何在 QTextBrowser 中显示 Unicode 字符?
【发布时间】:2015-02-10 04:22:41
【问题描述】:

我有一个包含 charset=utf-8 Unicode 字符的 HTML 文件。我可以阅读并显示QTextBrowser 中的内容。但是 Unicode 字符没有正确显示。我认为他们正在使用 ANSI 代码等效项出现,这非常奇怪且不可读。

如何在 QTextBrowser 中显示 Unicode 字符?

【问题讨论】:

    标签: html qt unicode


    【解决方案1】:

    您应该在您的 HTML 文件中设置一个元标记以指定内容为 UTF-8 格式。将标签放在标题中:

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

    QTextBrowser 会正确显示 unicode 字符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 2013-10-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多