Java/XSLT 字符编码

发布于 2024-09-07 11:07:08 字数 637 浏览 0 评论 0原文

我正在使用 XSLT 来显示一些   (空格)和£ (£) 符号,但它们都显示为问号(无法识别的字符)。

我的编码在 HTML 中设置为 UTF-8,XSLT 标头看起来像这样

<xsl:stylesheet
  version="1.0"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xhtml xsl">

<xsl:output method="xml" version="1.0" encoding="UTF-8" charset="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" indent="yes" omit-xml-declaration="yes" />

有人知道我哪里出错了吗?

非常感谢。

I am using XSLT to display some   (space) and £ (£) signs but they all come out as question marks (unrecognised characters).

My encoding is set to UTF-8 in the HTML and the XSLT header looks like this

<xsl:stylesheet
  version="1.0"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xhtml xsl">

<xsl:output method="xml" version="1.0" encoding="UTF-8" charset="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" indent="yes" omit-xml-declaration="yes" />

Does anyone have any ideas where I am going wrong?

Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梨涡 2024-09-14 11:07:08

我发现我将内容类型设置为 text/html - 将其设置为 text/html;charset=utf-8 纠正了问题

I found that I was setting the content type to text/html - setting it to text/html;charset=utf-8 corrected the problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文