我想知道如何让我的 UIWebView 正确显示这些字符。下图是我的 UIWebView 的快照,显示一些欧洲语言字符无法正确显示。我查看了该内容的原始网页,字符是正确的。我怀疑 UIWebView 中使用的 HTML 头中需要设置一些元标记。但我不确定它们会是什么。原始网页和我自己的 HTML 都是用 UTF-8 编码的,如下所示:
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
这应该是:
Pour sa première exposition à la Inception Gallery, Christine Barbe affiche une maturité dans son expérimentation en photographie et en vidéo. Elle témoigne d'une nouvelle réflexion profonde liée à notre condition d'humain au sein de notre environnement et à celle de l'intervention du corps dans l'imprégnation de cet environnement. ...
最佳答案
数据采用 UTF-8 编码,但 UIWebView 将其解释为 ISO-8859-1。这就是为什么例如“è” 呈现为“á”。
关于html - 这是什么编码以及如何在 UIWebView 中转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9971606/