重音字符未被正确检索 [英] Accented chars are not retrieved correctly
问题描述
specialcharacter123@eñe.es
然后,只有在Chrome浏览器的情况下 b
$ b 我试过: b
jQuery('#email')。val()
和
document.getElementById('email')。value
两者都给了我相同的结果。 (它在Safari中工作正常)。
另外,我已经在页面中显示了这一点:
< meta charset =utf-8/>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
我无法弄清楚这里有什么不对。
域名只能包含ASCII字符,请参阅国际化域名。该URL在做请求时可以很好地工作,但如果要将其显示为UTF8,则需要将其转换。有各种语言的解决方案,对于JavaScript,您可以使用。
I encountered this strange issue today. We have an email field in our page, and if a user enters:
specialcharacter123@eñe.es
Then only in case of Chrome I am getting specialcharacter123@xn--ee-zja.es
:
I tried:
jQuery('#email').val()
And
document.getElementById('email').value
Both gave me same results. ( It is working fine in Safari ).
Also I already have this in the page:
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I am unable to get any clue what's wrong here.
Domain names can include ASCII characters only, see Internationalized domain name. The URL will work just fine when doing requests, but if you want to display it as UTF8, you need to convert it. There are various solutions for various languages, for JavaScript you could use punycode.js.
这篇关于重音字符未被正确检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!