PHP 5、XSL 和字符 Ú
我很难
字母Ú
通过 PHP 5.3 和 XSL 呈现 。它是数据库中字符串的一部分,并加载到标签内的 XML 节点中。但是,它会导致 XSL/XML 转换无法呈现。从字符串中删除该字符可以立即解决问题。
有什么想法吗?
Im having dificulty getting the letter
Ú
to render through PHP 5.3 and XSL. Its part of a string in a database and that is loaded into an XML node within a tags. However it causes the XSL/XML transformation to not render. Removing the character from the string fixes the problem instantly.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您使用什么字符编码?从它的声音来看,你有某种字符编码不匹配。
如果您的 XSL 使用 ISO-8559-1(或等效的 ASCII)并且您尝试输出到 UTF-8 编码的页面,则字符输出将关闭。反之亦然。
What character encoding are you using? From the sounds of it you have some sort of character encoding mismatch.
If your XSL is using ISO-8559-1 (or ASCII equivalent) and you are trying to output to a page that is UTF-8 encoded then the character output will be off. It also works vice-versa.
实际上我不知道正确的答案,但我有一个如下的解决方案:
Actually I don't know right answer but I have a solution like below :
由于编码问题,您的 XSL 转换引擎可能会将您的文档解释为格式不正确的 XML。如果包含
Ú
的文本使用某种 8 位编码(例如 ISO-8859 变体)存储,则在不进行任何字符转换的情况下按原样使用该字符将不会生成有效的 UTF-8 八位字节。 XML 文档中的无效字符意味着它不是格式良好的 XML,并且禁止将其作为 XML 进行处理。在很多情况下都可能发生编码错误:
我对可能原因的随机猜测是第 3 点和 5.
Your XSL transformation engine probably interprets your document as non-well-formed XML because of encoding issues. If that text containing
Ú
is stored using some 8-bit encoding (like ISO-8859 variants), then this character will not produce a valid UTF-8 octet if it is used as such without any character conversion. Invalid characters in an XML document will mean it is not well formed XML and processing it as XML is forbidden.There are many points where that encoding error might happen:
My random guesses for the probable causes of that are points 3 and 5.