警报会正确显示吗? [英] will the alerts displaying correctly?

查看:51
本文介绍了警报会正确显示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用非英文文本正确显示javascript警报

计算机上只有英文版本的默认系统&语言设置?

对于网页,解决方案只是使用元标记:

< meta http-equiv =" Content-Type" content =" text / html;

charset = windows-1251">

这也适用于javascript警报吗?

How to make javascript alert with non-english text displaying correctly
on computers where english only is default system & language settings?
For web page the solution is just use meta tags:
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1251">
Will this work for javascript alerts also?

推荐答案

任何想法?

Any ideas?


ko **** @ hotmail.com 写道:
ko****@hotmail.com wrote:
如何在计算机上正确显示非英文文本的javascript警报
英语只是默认系统&语言设置?
对于网页,解决方案只是使用元标记:
< meta http-equiv =" Content-Type" content =" text / html;
charset = windows-1251">
这也适用于javascript警报吗?
How to make javascript alert with non-english text displaying correctly
on computers where english only is default system & language settings?
For web page the solution is just use meta tags:
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1251">
Will this work for javascript alerts also?




也许,也许不吧。 Windows-1251(西里尔语)当然包括不属于英语的字符

。[1] (系统和用户

界面语言并不重要。)但是你应该总是发送正确的

Content-Type HTTP标头来声明正确的资源编码(哪个

优先于任何meta [http-equiv])来编码HTML文档字符集(UCS)的已用字符

,并包含meta [http-equiv] for

仅限本地使用。[2]


如果该编码不允许按原样对字符进行编码,则可以

要么使用字符引用(CR)或字符实体引用(CERs)

_in markup_,例如`Й'',要么更改资源的编码

内容本身(并声明新的编码)。这是一种常见的错误概念,即标记资源的编码会限制你对特定字符集的
。事实并非如此; HTML 4.01和XML

文档将始终使用UCS作为文档字符集。[3] [4]


请注意,在JS中不评估CR和CER字符串,除非JS代码的片段是CDATA _attribute_内容(或者PCDATA _element_内容,你通常不想要的是
)。

PointedEars

___________

[1]< URL:http://en.wikipedia.org/wiki/Windows-1251>


[2]< URL:http://rfc-editor.org/rfc/rfc1945.txt>,10.5

< URL:http://rfc-editor.org/ rfc / rfc1945.txt>,14.17

[3]< URL:http://www.w3.org/TR/html4/charset.html#doc-char-set> ;

< URL:http://www.w3.org/TR/html4/sgml/sgmldecl.html>


< URL:http ://www.w3.org/TR/REC-xml/#charsets>

< URL:http://www.w3.org/TR/xml11#charsets>

< URL:http://www.w3.org/TR/NOTE-sgml-xml-971215.html#null3>


[4]有趣的是,HTML 3.2文件仅使用ISO 646(IA5):

< URL:http://www.w3.org/TR/REC-html32#sgmldecl>



Maybe, maybe not. Windows-1251 ("Cyrillic") certainly includes characters
that are not part of the English language.[1] (The system and user
interface language do not matter.) But you SHOULD always send the correct
Content-Type HTTP header to declare the correct resource encoding (which
takes precedence over any meta[http-equiv]) to encode the used characters
of the HTML Document Character Set (UCS), and include meta[http-equiv] for
local use only.[2]

If that encoding does not allow to encode the character as-is, you can
either use character references (CRs) or character entity references (CERs)
_in the markup_, such as `Й'', or change the encoding of the resource
content itself (and declare the new encoding instead). It is a common
misconception that the encoding of a markup resource would restrict you
to a certain character set. That is not the case; HTML 4.01 and XML
documents will use UCS as Document Character Set always.[3][4]

Note that CRs and CERs are not evaluated within JS strings, unless the piece
of JS code is CDATA _attribute_ content (or PCDATA _element_ content, what
you usually do not want).
PointedEars
___________
[1] <URL:http://en.wikipedia.org/wiki/Windows-1251>

[2] <URL:http://rfc-editor.org/rfc/rfc1945.txt>, 10.5
<URL:http://rfc-editor.org/rfc/rfc1945.txt>, 14.17

[3] <URL:http://www.w3.org/TR/html4/charset.html#doc-char-set>
<URL:http://www.w3.org/TR/html4/sgml/sgmldecl.html>

<URL:http://www.w3.org/TR/REC-xml/#charsets>
<URL:http://www.w3.org/TR/xml11#charsets>
<URL:http://www.w3.org/TR/NOTE-sgml-xml-971215.html#null3>

[4] Interestingly, HTML 3.2 documents use only ISO 646 (IA5) instead:
<URL:http://www.w3.org/TR/REC-html32#sgmldecl>




Thomas''PointedEars''Lahn D?D ??? D°D?(D°):

Thomas ''PointedEars'' Lahn D?D???D°D?(D°):
ko **** @ hotmail.com 写道:
ko****@hotmail.com wrote:
如何正确显示非英文文本的javascript警报
在英语只有默认系统和计算机的计算机上语言设置?
对于网页,解决方案只是使用元标记:
< meta http-equiv =" Content-Type" content =" text / html;
charset = windows-1251">
这也适用于javascript警报吗?
How to make javascript alert with non-english text displaying correctly
on computers where english only is default system & language settings?
For web page the solution is just use meta tags:
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1251">
Will this work for javascript alerts also?



也许,也许不是。 Windows-1251(西里尔语)当然包括不属于英语的字符
。[1] (系统和用户界面语言并不重要。)但是你应该总是发送正确的内容类型HTTP头来声明正确的资源编码(
优先于任何元[ http-equiv])对HTML文档字符集(UCS)中使用过的字符进行编码,并包含meta [http-equiv],仅供本地使用。[2]
文档将始终使用UCS作为文档字符集。[3] [4]

请注意,在JS字符串中不评估CR和CER,除非该部分
JS代码是CDATA _attribute_内容(或PCDATA _element_内容,你通常不想要的内容)。

PointedEars
___________
[1]< URL :http://en.wikipedia.org/wiki/Windows-1251>

[2]< URL:http://rfc-editor.org/rfc/rfc1945.txt>,10.5
< URL:http://rfc-editor.org/rfc/rfc1945.txt>,14.17

[3]< URL:http://www.w3.org /TR/html4/charset.html#doc-char-set>
< URL:http://www.w3.org/TR/html4/sgml/sgmldecl.html>
< URL:http://www.w3.org/TR/REC-xml/#charsets>
< URL:http://www.w3.org/TR/xml11#charsets>
< URL:http://www.w3.org/TR/NOTE-sgml-xml-971215.html#null3>

[4]有趣的是,HTML 3.2文档仅使用ISO 646 (IA5):
< URL:http://www.w3.org / TR / REC-html32#sgmldecl>



Maybe, maybe not. Windows-1251 ("Cyrillic") certainly includes characters
that are not part of the English language.[1] (The system and user
interface language do not matter.) But you SHOULD always send the correct
Content-Type HTTP header to declare the correct resource encoding (which
takes precedence over any meta[http-equiv]) to encode the used characters
of the HTML Document Character Set (UCS), and include meta[http-equiv] for
local use only.[2]

If that encoding does not allow to encode the character as-is, you can
either use character references (CRs) or character entity references (CERs)
_in the markup_, such as `Й'', or change the encoding of the resource
content itself (and declare the new encoding instead). It is a common
misconception that the encoding of a markup resource would restrict you
to a certain character set. That is not the case; HTML 4.01 and XML
documents will use UCS as Document Character Set always.[3][4]

Note that CRs and CERs are not evaluated within JS strings, unless the piece
of JS code is CDATA _attribute_ content (or PCDATA _element_ content, what
you usually do not want).
PointedEars
___________
[1] <URL:http://en.wikipedia.org/wiki/Windows-1251>

[2] <URL:http://rfc-editor.org/rfc/rfc1945.txt>, 10.5
<URL:http://rfc-editor.org/rfc/rfc1945.txt>, 14.17

[3] <URL:http://www.w3.org/TR/html4/charset.html#doc-char-set>
<URL:http://www.w3.org/TR/html4/sgml/sgmldecl.html>

<URL:http://www.w3.org/TR/REC-xml/#charsets>
<URL:http://www.w3.org/TR/xml11#charsets>
<URL:http://www.w3.org/TR/NOTE-sgml-xml-971215.html#null3>

[4] Interestingly, HTML 3.2 documents use only ISO 646 (IA5) instead:
<URL:http://www.w3.org/TR/REC-html32#sgmldecl>



----------


我已经测试过了它对我有用。我只想确定

用户会看到正确的文字。我只能依靠正确的字符集。

感谢您的信息。


----------

I''ve tested it and it worked OK for me. I just want to be sure that the
users will see correct text. I can rely on correct charset only.
Thanks for info.


这篇关于警报会正确显示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆