-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UTF-8 Asset is not output as UTF-8 #65
Comments
Seems my solutions works on text files (e.g. JS, CSS) but not on image, I got error on the java.io.PrintWriter.write() method which does not accept byte objects. I updated the checking as below:
|
We bypass character encoding with outputStream as its a byteStream which has no encoding |
I found that the AssetsController will serve two kinds of streams:
For 1), it is true that no encoding is required, however for 2), character encoding is required. I deployed the plugin version 1.5.7 on Windows and followed the instructions, however the Javascript is still not served properly. With the code modification above, both images (binary) and Javascript (character) are served properly. Suggestion welcomed. |
Ok so I resolved this issue a bit differently. The assetProcessorService now always sends a byte stream not a String. This byte stream is now properly converted based on encoding passed. It should be available for use in 1.5.8 |
Oh it is ok too, as I found that it is a bit strange that it returns string while the definition of AssetFile seems not restricted to character stream. |
I will test it tomorrow on my Windows machine and report whether it works. |
Yea cool thanks! Would love to get this out of the way before grails 2.4 |
I tried development mode and played with the configuration option "grails.assets.bundle = true/false" and both works when running "run-app" in Grails console. Only thing I didn't test yet is in production mode (run-war as well as deployment in application server e.g. Tomcat/Jetty) |
Glad to hear it less concerned for production as that is entirely byte level Sent from my iPhone
|
This is me again, which reported issue #62 and #63.
It seems that the version 1.5.7 does not properly fixed the issue. I am running Windows, and the served file is still corrupted.
I found that the AssetsController still uses response.outputStream to serve the file content, which does not specify the exact character encoding.
Here is a link related to a SO question: http://stackoverflow.com/questions/1992400/how-to-send-through-servletoutputstream-characters-in-utf-8-encoding
In issue #62 I have added the following code but it is not used in the plugin version 1.5.7:
The text was updated successfully, but these errors were encountered: