西班牙语特殊字符

西班牙语特殊字符

本文介绍了西班牙语特殊字符,如áó,同时显示显示混杂或垃圾值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个西班牙语验证消息,我试图使用我的JavaScript显示。
和上面所有的特殊字符改变为& #243 ;.
这只是发生在我使用JavaScript,西班牙语有更多的验证消息,我通过服务器端显示他们很好。

I have a Spanish validation message which I'm trying to display using my JavaScript.And all the special characters like above gets changed into & #243;.And it is only happening when I'm using JavaScript, there are couple of more validation messages in Spanish which I'm displaying through server side and they are fine.

errorString =;

errorString = "<%:Validation.xyz %>";

我试图从资源文件中获取。

I'm trying to get from resource file.

有人能想到快速工作吗?

Can some one think of quick work around?

推荐答案

em>实际上是对应的字符的HTML编码值,是为了防止你从XSS。编码发生,因为你使用<%:它自动HTML编码字符串,但这不应该是一个问题的JavaScript。示例:

What you call garbage is actually but the HTML encoded value of the corresponding character and is there to prevent you from XSS. The encoding happens because you are using <%: which automatically HTML encodes the string but this shouldn't be a problem for your javascript. Example:

var text = 'hello &#243';
document.getElementById('foo').innerHTML = text;

工作正常,并显示 helloó对应的DOM元素。

works just fine and displays hello ó in the corresponding DOM element.

这篇关于西班牙语特殊字符,如áó,同时显示显示混杂或垃圾值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:01