【问题标题】:Why do Umlauts and special characters not show up correctly in my Grails pages?为什么元音变音和特殊字符不能正确显示在我的 Grails 页面中?
【发布时间】:2008-10-18 13:01:03
【问题描述】:

如何确保 Grails 使用正确的编码 (UTF-8)?

【问题讨论】:

    标签: grails groovy content-encoding


    【解决方案1】:

    比我想象的要容易 - 只需确保您的编辑器设置为 UTF-8 编码。

    【讨论】:

      【解决方案2】:

      我发现有时将文件类型设置为 UTF-8 是不够的。有时你需要告诉 AppServer。

      response.setContentType("text/html; charset=UTF-8");
      request.setCharacterEncoding("UTF-8");

      【讨论】:

        【解决方案3】:

        也许您不应该使用 UTF-8。也许您应该尝试 8859 ISO 字符集之一:http://www.global-translation-services.com/iso8859.html#ISO-8859-1

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2015-01-22
          • 2012-05-24
          • 2013-08-06
          • 1970-01-01
          • 2015-05-24
          • 1970-01-01
          • 2011-04-18
          • 1970-01-01
          相关资源
          最近更新 更多