Encode loss while minimizing javascript in Grails

3

In my javascript file there is a message with the string "service" for example. When I run the project (run-app) and check the javascript by the browser, the word appears as: "service". But this is displayed correctly on the screen when the message is invoked.

But when I run the system through a package, and check the javascript through the browser, the word appears as: "service". When the message appears on the screen, it displays: "service"

I found a person with the same problem as mine at this link: link

But the solution to using "-Dfile.encoding = UTF-8" did not work for me.

I tried the commands below and nothing:

grails -Dfile.encoding = UTF-8 package

gradle -Dfile.encoding = UTF-8 assetCompile

    
asked by anonymous 09.05.2016 / 09:05

1 answer

0

Victor this has happened to me, the following is the encoding of the response of your request is different from UTF-8, which is the reason for this disorder, what you can do is to manually do this within the action of your controller, or you can create a Grails interceptor and set up the enconding on all your requests, I did this in my application and it works perfectly, it follows the interceptor code.

class EncodingInterceptor {

    public EncodingInterceptor(){
        match controller: '*'
    }

    boolean before() {
        response.characterEncoding = 'UTF-8'
    }
}
    
01.07.2016 / 00:49