å xml文件中的内容是否有效?
IE 不喜欢在 XML 文件中显示 å 字符。 这是一个 IE 问题还是 å 和类似的字符确实是无效的 XML,我是否必须创建 &#xxx;所有这些字母的值?
顺便说一句,米歇尔
:字符位于 CDATA 标记内
声明如下: 嗯,似乎无法将 xml 声明粘贴到我的帖子中,它被删除或隐藏在我帖子的 html 中,我想,尝试了反引号、4 个空格等将其标记为代码。但是,它与答案中所说的相同
声明是这样的:
<?xml version="1.0" encoding="utf-8"?>
片段是
<resource key="erroraspx-errorDescription" value="cdata">
<![CDATA[Något gick fel. Klicka <a href=".">här</a> för att gå till webbsidan ]]>
</resource>
IE doesn't like the å character in an XML file to display.
Is that an IE problem or are å and alike chars indeed invalid XML and do i have to create the xx; values for all these letters?
Michel
by the way: the chars are inside a CDATA tag
The declaration is this:
hmm, can't seem to get the xml declaration pasted in my post, it gets deleted or hidden in the html of my post i think, tried the backtick, 4 spaces etc to mark it as code. However, it's the same as sais in the answers
The declaration is this:
<?xml version="1.0" encoding="utf-8"?>
The snippet is
<resource key="erroraspx-errorDescription" value="cdata">
<![CDATA[Något gick fel. Klicka <a href=".">här</a> för att gå till webbsidan ]]>
</resource>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我很确定这是一个编码问题。您需要检查文件的编码确实是国际化的,例如 UTF-8,并且 xml 标头表明了这一点。
xml 文件应以以下内容开头
I am pretty sure that this is an encoding problem. You need to check that the encoding of your file is indeed something internationalised, like UTF-8, and that the xml header indicates this.
The xml file should start with
<?xml version="1.0" encoding="UTF-8"?>
我认为这取决于您为 XML 文件定义的字符集/编码。
I would think that would depend on the character set/encoding you had defined for the XML file.
我的猜测是您的文本采用 ISO-8859-1 编码,因为它在瑞典常用。
尝试添加:
我会考虑将文本转换为 UTF-8。
My guess is that your text in encoded in ISO-8859-1 since that is commonly used in Sweden.
Try adding:
I would consider converting the text to UTF-8.
您始终可以这样使用实体:
获取:
也许不完全是您想要的,但这是一个很好的解决方法。您可以使用 utf8-chartable.de 等网站查找所需的值。
You allways can use entities as this:
to get:
Maybe not exactly what you want, but a nice workaround. You can use sites like utf8-chartable.de to look up the needed value.
这是一个编码问题。如果 xml 中提供了文件的编码,则应该可以正确识别。例如,如果您的文件是 latin1,则 xml 必须以此行开头:
您可以省略
encoding
属性,确定 xml 的默认编码 可能有点棘手。This is an encoding issue. If the encoding of the file is provided in the xml, it should be recognized correctly. If your file is latin1, for example, the xml must start with this line:
You can omit the
encoding
attribute, determining the default encoding of the xml can be a bit tricky, though.确保您实际使用 XML 中指定的编码保存文件。
例如,记事本默认将文件保存为 ANSI 而不是 UTF-8。使用“另存为...”选项以便您可以指定编码。
我将您的 XML 保存为 UTF-8 文件,这在 IE 中显示得很好。
Make sure that you actually save the file using the encoding that is specified in the XML.
The Notepad for example by default saves files as ANSI rather than UTF-8. Use the "Save As..." option so that you can specify the encoding.
I saved your XML as an UTF-8 file, and that shows up just fine in IE.