Created
March 23, 2018 14:50
-
-
Save efinal/cf6187b38b8519e77aad528a479d7af8 to your computer and use it in GitHub Desktop.
griffon application can't show message.properties with utf8 encoding correctly by default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check the source code as described here: https://stackoverflow.com/a/4660195/828181, it's because the PropertiesReader use the default 'ISO-8859-1' encoding. | |
the solution is binding your own PropertiesReader and read the stream as utf-8: | |
public class PropertiesReader extends griffon.util.PropertiesReader { | |
@Nonnull | |
public Properties load(@Nonnull InputStream stream) throws IOException { | |
Properties p = new Properties(); | |
p.load(new InputStreamReader(stream, "UTF-8")); | |
return this.processProperties(p); | |
} | |
} | |
and in the ApplicationModule: | |
bind(griffon.util.PropertiesReader.class) | |
.to(PropertiesReader.class) | |
.asSingleton(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment