IE11不会逃逸连接的“<”字符 [英] IE11 does not escape a concatenated "<" character
问题描述
我有一个字符串, hello< whatever>,你好吗?
。当我检查页面源,我得到正确的渲染的字符串(用特殊字符转换)。
I have a string, say hello <whatever>, how are you?
. When I check the "page source", I get proper rendering of that string (with special characters converted).
但是,如果我尝试读取该字符串,在弹出的窗口消息中,消息将显示 hello,你好吗?
。如果我在<
字符之后放置一个空格(即: hello< whatever& ),弹出消息正确显示:
hello<
However, if I try to read that string and put it on a pop-up window message, the message will read hello , how are you?
. If I place a space after the <
character (i.e.: hello < whatever >, how are you?
), the pop-up message displays correctly: hello < whatever >, how are you?
.
如何正确转义<
字符,以便整个文本正确读取? & lt;
和& 064;
不执行任何操作(请记住,
How can I properly escape the <
character so that the entire text gets read properly? <
and &064;
does not do the trick (remember that they are properly converted anyway).
摘要:任何具有<
特殊字符的字符串,后跟任何字母字符,不能被IE(11)正确读取。
Summary: any string that has a <
special character followed by any alphabetical character without any blank space in between cannot be properly read by IE(11).
编辑:一旦我发布了这个问题,你可以看到我的意思是通过阅读第一句。它显示为 hello,你好吗?
即使我输入 hello<字符和
之间没有空格。 。
As soon as I posted this question, you can see what I mean by reading the first sentence. It shows as hello , how are you?
even though I typed hello < whatever>, how are you?
with no space between the <
character and whatever
.
推荐答案
您需要使用HTML字符编码:
You need to use HTML character encoding:
< for <
> for >
请参阅 W3C的字符实体参考图表了解更多信息。
这篇关于IE11不会逃逸连接的“<”字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!