Maison  >  Article  >  interface Web  >  在html页面中的这个<p>u5982 是什么意思?求教。_html/css_WEB-ITnose

在html页面中的这个<p>u5982 是什么意思?求教。_html/css_WEB-ITnose

WBOY
WBOYoriginal
2016-06-24 11:45:262939parcourir

打开一个html页面,发现里面有这样的代码,请问其中的\u5982这个是什么东西?是十六进制编码的文字吗?为什么不是直接文字?

\u5982\u4f60\u6240\u89c1\uff0c\u5927\u4f17\u6c7d\u8f66\u4e3a\u5ba2\u6237\u63d0\u4f9b\u4e00\u4e9b E-mobility \u7684\u6269\u5c55\u670d\u52a1\u3002 \u5728\u4e0b\u4e00\u9875\u4e2d\uff0c\u4f60\u5c06\u770b\u5230\u8fd9\u4e9b\u670d\u52a1\u662f\u5982\u4f55\u5171\u540c\u7ec4\u6210\u4e00\u4e2a\u6574\u4f53\u6982\u5ff5\u7684\u3002"


回复讨论(解决方案)

中文的uncode编码。

document.write('<p>\u5982\u4f60\u6240\u89c1\uff0c\u5927\u4f17\u6c7d\u8f66\u4e3a\u5ba2\u6237\u63d0\u4f9b\u4e00\u4e9b E-mobility \u7684\u6269\u5c55\u670d\u52a1\u3002 \u5728\u4e0b\u4e00\u9875\u4e2d\uff0c\u4f60\u5c06\u770b\u5230\u8fd9\u4e9b\u670d\u52a1\u662f\u5982\u4f55\u5171\u540c\u7ec4\u6210\u4e00\u4e2a\u6574\u4f53\u6982\u5ff5\u7684\u3002<\/p>');

这样不怕乱码,直接输入中文的话,只要改下网页编码,应该就会出现乱码

中文的uncode编码。

document.write('<p>\u5982\u4f60\u6240\u89c1\uff0c\u5927\u4f17\u6c7d\u8f66\u4e3a\u5ba2\u6237\u63d0\u4f9b\u4e00\u4e9b E-mobility \u7684\u6269\u5c55\u670d\u52a1\u3002 \u5728\u4e0b\u4e00\u9875\u4e2d\uff0c\u4f60\u5c06\u770b\u5230\u8fd9\u4e9b\u670d\u52a1\u662f\u5982\u4f55\u5171\u540c\u7ec4\u6210\u4e00\u4e2a\u6574\u4f53\u6982\u5ff5\u7684\u3002<\/p>');

这样不怕乱码,直接输入中文的话,只要改下网页编码,应该就会出现乱码



在页面的开始设置元标签:meta charset=utf8 这个能解决乱码的问题么?

中文乱码是由于编码不一致造成的,比如你的页面编码是utf8,那么你的meta也要设置utf8,这样才能输出中文,但用uncode编码后的中文的话即使meta设置成GBK也可以正常显示中文

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn