“\ h”有特殊含义吗?

[英]Is there a special meaning of “\h”?


Does \h have some special meaning? I store the username in a hidden field in my HTML, and all usernames works, but mine (which is DOMAIN\hers....) fails, it ends up like "DOMAINhers...) when picked up by Javascript (JQuery).

它有一些特殊含义吗?我将用户名存储在我的HTML中的隐藏字段中,并且所有用户名都可以工作,但是我的(这是DOMAIN \她的......)失败了,当它被Javascript(JQuery)选中时,它最终会像“DOMAINhers ...”一样。

Any ideas?

3 个解决方案

#1


When storing strings in JavaScript you should allways escape the \ character, by replacing "\" with "\\". Just image when someone has the username "DOMAIN\noel". That will end up like

在JavaScript中存储字符串时,你应该通过用“\\”替换“\”来逃避\字符。只有当有人拥有用户名“DOMAIN \ noel”时才会成像。那最终会像

DOMAIN
oel

#2


\h isn't an escape character in Javascript.

\ h不是Javascript中的转义字符。

#3


There is no special meaning for "\h", but the backslash will still be escaped. You'll have to escape the backslash itself for your username to work so that you have "DOMAIN\hers....".

“\ h”没有特殊含义,但反斜杠仍将被转义。你必须逃避反斜杠本身才能使你的用户名工作,这样你才能拥有“DOMAIN \她的......”。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2009/07/22/4cb199b3dcdf7f7b5f25bb6cbbfa2bc7.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告