如何在没有转义字符的情况下使用grails生成真正的UTF-8 XML ?

时间:2022-05-05 00:18:04

I have been wondering why when I set the encoding to UTF-8 and rendering the XML it replace the extended characters by escape characters (or character reference) like ’ instead of '?

我一直在想,为什么当我将编码设置为UTF-8并呈现XML时,它会用转义字符(或字符引用)替换扩展字符,比如’而不是“?

I'm using the Render method

我用的是渲染方法

render(contentType:"text/xml", encoding:"UTF-8") {...}

with a proper header

用一个合适的标题

render(contentType:"text/xml", encoding:"UTF-8", text:"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") 

Any idea if there is a way to write it properly?

你知道有没有合适的方法来写吗?

Thanks.

谢谢。

1 个解决方案

#1


0  

Do you have anything set in Config.groovy like grails.converters.encoding? What is it set to?

你有什么配置吗?groovy grails.converters.encoding吗?它的值是多少?

#1


0  

Do you have anything set in Config.groovy like grails.converters.encoding? What is it set to?

你有什么配置吗?groovy grails.converters.encoding吗?它的值是多少?