javascript警报中的外来字符 [英] Foreign characters in javascript alerts

查看:72
本文介绍了javascript警报中的外来字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用带有重音字符的法语警报,而我得到的是胡言乱语。


如何正确显示警告信息,因为重音字符的HTML字符代码在javascript警报中不起作用?


脚本存储在.js文件中,我从HTML引用它。 HTML文档是4.01 Transitional,语言是UTF-8。


非常感谢任何帮助。

I must use alerts in French with accented characters and what I get is gibberish.

How can I display alert messages properly, as HTML character codes for accented characters don''t work in javascript alerts?

The scripts are stored in a .js file and I am referencing it from HTML. The HTML document is 4.01 Transitional and the language is UTF-8.

Any help is greatly appreciated.

推荐答案

可以你给出了一些不起作用的代码示例。
Can you give some examples of codes that don''t work.



我必须使用带有重音字符的法语警报,我得到的是胡言乱语。


如何正确显示警告信息,因为重音字符的HTML字符代码在javascript警报中不起作用?


脚本存储在.js文件中,我从HTML引用它。 HTML文档是4.01 Transitional,语言是UTF-8。


非常感谢任何帮助。
I must use alerts in French with accented characters and what I get is gibberish.

How can I display alert messages properly, as HTML character codes for accented characters don''t work in javascript alerts?

The scripts are stored in a .js file and I am referencing it from HTML. The HTML document is 4.01 Transitional and the language is UTF-8.

Any help is greatly appreciated.



而不是用法语编写信息,为每个字符写下 Unicode

您可以在此处找到Unicode字符


例如,对于 alert(''ABC'');

使用 alert(''\ u0041 \ u0042 \ u0043 '');

Instead of writing the message in French, write the Unicode for each character.
You may find the Unicode characters here.

eg, for alert(''ABC'');
use alert(''\u0041\u0042\u0043'');


我道歉但是一些紧急情况使我无法回应。谢谢你们的回复。有问题的字符是é(ANSI 02333)或? (ANSI 0244)等


输入警报(Veuillez indiquer le nom desocieté!),其中警报包含实际字符会在打开网页时生成HTML错误。


使用é字符的十六进制值输入为警报(Veuillez indiquer le nom de societ\0xE9!),前面有转义码,显示一个方框。


非常感谢您的其他评论。
I apologize but some emergencies prevented me from responding. Thank you both for the replies. The characters in question are with accents or circumflex like é (ANSI 02333) or ? (ANSI 0244) etc.

Inputting as alert("Veuillez indiquer le nom de societé!") where the alert contains the actual character generates an HTML error when opening the web page.

Inputting as alert("Veuillez indiquer le nom de societ\0xE9!") using the hex value for the é character, preceded by the escape code, displays a box.

Your additional comments would be greatly appreciated.


这篇关于javascript警报中的外来字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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