简体   繁体   English

尽管UTF-8元标记已应用于html文件,但HTML特殊字符仍未在浏览器中显示

[英]Html special characters not being shown in browser despite UTF-8 meta tag applied to html file

I am using jquery method to load html file in a div content as like 我正在使用jquery方法在div内容中加载html文件,例如

<script type="text/javascript" language="javascript" >
$(function () {
    $("#divWelcomePage").load("welcome.html");
});

Now, The issue is I got the html file content over there but am not getting the value of special characters like (apostrophe('),double quotes("") in the div. 现在,问题是我在那儿获取了html文件的内容,但是没有得到div中特殊字符((撇号('),双引号(“”))的值。

Then I put a tag like 然后我放一个像

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

and Now,it works for some html pages but for some other pages I still don't get any value. 现在,它适用于某些html页面,但对于某些其他页面,我仍然没有任何价值。 Instead I get character:( 相反,我得到了-character :(

Please suggest some really reliable way for me to do so. 请提出一些非常可靠的方法让我这样做。 I have also studied that using html editor to convert these html files to support UTF characters can make this html file work But still it is not working as I have tried to use a few html editor like Sublime Text 2 . 我还研究了使用html编辑器将这些html文件转换为支持UTF字符的方法,可以使该html文件正常工作,但是由于我尝试使用一些Sublime Text 2这样的html编辑器,因此仍然无法正常工作。 Please suggest me some good html editor too if you still believe using those editors will help my case.. 如果您仍然相信使用那些HTML编辑器对我的案例有帮助,请也向我建议一些优秀的HTML编辑器。

You need to include a valid doctype for html entities to display correctly. 您需要包含一个有效的doc类型,以便html实体正确显示。

Try adding this to your welcome.html page 尝试将其添加到您的welcome.html页面

<!DOCTYPE html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM