Grails 圣杯&x27;respond方法输出字符集为ISO-8859-1的HTML内容

Grails 圣杯&x27;respond方法输出字符集为ISO-8859-1的HTML内容,grails,Grails,我刚刚注意到控制器中的respond方法返回ISO-8859-1字符集中的HTML响应(这会使我的unicode字符乱码)。如果我将格式设置为JSON,它将使用UTF-8。render方法也使用UTF-8 我正在使用Grails2.4.4和Tomcat插件v。7.0.55处于开发模式,无需覆盖web.xml。grails.converter.encoding和grails.views.gsp.encoding都设置为UTF-8。我的模板中有,如果这会影响任何内容 我还尝试使用respond my

我刚刚注意到控制器中的
respond
方法返回ISO-8859-1字符集中的HTML响应(这会使我的unicode字符乱码)。如果我将格式设置为JSON,它将使用UTF-8。
render
方法也使用UTF-8

我正在使用Grails2.4.4和Tomcat插件v。7.0.55处于开发模式,无需覆盖
web.xml
grails.converter.encoding
grails.views.gsp.encoding
都设置为UTF-8。我的模板中有
,如果这会影响任何内容

我还尝试使用
respond myInstance[encoding:“UTF-8”]
强制使用字符集,但它没有改变任何东西

有什么东西我没有看到或者我碰到了错误吗

编辑:my
config.groovy
包含以下mime类型定义:

grails.mime.types = [ // the first one is the default format
    all:           '*/*', // 'all' maps to '*' or the first available format in withFormat
    atom:          'application/atom+xml',
    css:           'text/css',
    csv:           'text/csv',
    form:          'application/x-www-form-urlencoded',
    html:          ['text/html','application/xhtml+xml'],
    js:            'text/javascript',
    json:          ['application/json', 'text/json'],
    multipartForm: 'multipart/form-data',
    rss:           'application/rss+xml',
    text:          'text/plain',
    hal:           ['application/hal+json','application/hal+xml'],
    xml:           ['text/xml', 'application/xml']
]

这似乎是一个Grails bug,我已经缩小了它发生时的具体情况:您需要对控制器设置
static responseFormats=['html',…]
限制才能触发它。Grails的
生成restful控制器
包含
响应格式
块,这一事实使开发人员更容易遇到这个问题

我已经提交了一份申请

编辑:要保留
响应格式
块,但仍有
UTF-8
响应,可以手动设置编码,可能如下所示:

def beforeInterceptor = {
    response.characterEncoding = 'UTF-8' //workaround for https://jira.grails.org/browse/GRAILS-11830
}

你能分享Config.groovy的grails.mime.types设置吗?我已经更新了JIRA上确认的问题.Bug,计划在2.4.5中解决