在Web浏览器上显示UTF-16字符 [英] Displaying UTF-16 characters on web browser
问题描述
佄呃⁅汭汭㰊瑨汭汭ഊ敨摡ാാ†††楴汴㹥㹥楬畮⁸楆楤灳慬獹朠朠慢慢慢慲琐琐⁵⁵⁵景5眠眠畓畓畓†湩湩楴†††湩湩㵬㵬猢潨玱畣⁴捩汤•牨晥∽瑨灴⼺振湤献瑳瑡捩渮瑥猯灵牥猎牥椯杭是痴捩汤椮潣㸢††氼湩敲㵬愢灰敬琭畯档如何在浏览器中显示UTF文件?如何使浏览器显示UTF文件? -16个字符而不破坏页面?
用符号泛滥摘录看起来像一个HTML文档是UTF-8编码,但被视为是UTF-16编码。或者它可能包含大多数UTF-8数据和一些UTF-16编码数据,这是行不通的。编码并在HTTP标头和/或 meta
标签中声明编码,然后一些浏览器会显示它OK,有些则不会。搜索引擎通常不能处理UTF-16,而UTF-16大部分都是不用的,不应该在网络上使用,除非在知情同意的合作伙伴之间达成相互协议。
I printed some UTF-16 encoded characters and tried to display it in Firefox and it displayed it as �.
So I went to Tools->Encoding and changed the encoding from UTF-8 to UTF-16 (I also tried changing charset directly in the HTML) However, when I did that, my page was completely flooded with symbols:
ℼ佄呃偙⁅瑨汭ാ㰊瑨汭ാഊ㰊敨摡ാ †ഠ †㰠楴汴㹥楬畮⁸楆敲潦⁸楤灳慬獹朠牡慢敧挠慨慲瑣牥湩氠敩⁵景眠扥 瀠条畓数獕牥⼼楴汴㹥††氼湩敲㵬猢潨瑲畣⁴捩湯•牨晥∽瑨灴⼺振湤献瑳瑡捩渮瑥猯灵牥獵牥椯杭是癡捩湯椮潣㸢††氼湩敲㵬愢灰敬琭畯档椭潣≮栠敲㵦栢瑴㩰⼯摣獳慴楴敮............
How can web browsers display UTF-16 characters without wrecking the page?
The "flooded with symbols" excerpt looks like an HTML document that is UTF-8 encoded but treated as if it were UTF-16 encoded. Or it might contain mostly UTF-8 data with some UTF-16 encoded data thrown in, which won’t work.
If you save your data as properly UTF-16 encoded and declare the encoding in HTTP headers and/or meta
tags, then some browsers will display it OK, some won’t. Search engines generally fail to process UTF-16, and UTF-16 is mostly not used and should not be used on the web, except by mutual agreement between consenting well-informed partners.
这篇关于在Web浏览器上显示UTF-16字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!