0

I am facing a problem on copying some messages.properties before the war generation, in my Grails application, I am doing it by putting the following code in my 'BuildConfig.groovy' file like THIS documentation shows :

grails.war.resources = { stagingDir, args ->
    copy(file: "grails-app/conf/custom-web.xml",
         tofile: "${stagingDir}/WEB-INF/web.xml")
}

In this snippet the web.xml is been copied but in mine application I am copying a .propertie file used in some Jasper reports, my code is like bellow:

copy(TODIR: "${stagingDir}/WEB-INF/classes/grails-app/i18n") {
        fileset(dir: "grails-app/i18n")
    }

When i open the resulted files it is everything OK (no character problems) but when i generate the report the special character like '^', '`', 'รง', etc. I have character encode problems. I tried to set UTF-8 in my tomcat server but it does not works too. When I copy the files manually, when the app is already deployed to tomcat, and replace it with the copied by code above IT WORKS. Any idea?

Thanks in advance!!

cristianchiess
  • 633
  • 7
  • 12

1 Answers1

0

In Java, .properties files cannot be encoded in UTF-8:

http://en.wikipedia.org/wiki/.properties

This is a strange, well-known legacy limitation of Java. See this question for the workaround:

How to use UTF-8 in resource properties with ResourceBundle

Community
  • 1
  • 1
Dave L.
  • 9,595
  • 7
  • 43
  • 69