Skip to content

Instantly share code, notes, and snippets.

@efinal
Created March 23, 2018 14:50
Show Gist options
  • Save efinal/cf6187b38b8519e77aad528a479d7af8 to your computer and use it in GitHub Desktop.
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
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