Every time I return to Java, I’m reminded by how hard simple things seem to be. Localisation is often quite important for applications, so I expected UTF-8 support out of the box with Spring Framework and Java via their ResourceBundleMessageSource and standard ResourceBundle classes.
Things are never that simple as pointed out by the following articles:
- Spring’s Juergen Hoeller on UTF-8 support and MessageSource
- Quick and dirty hack for UTF-8 support in Resource Bundle
- Loading resource bundle with UTF-8
- 2003 bug on UTF-8 support in property files
- Solution for UTF-8 encoding problem inside property files
- UTF-8 encoding and message sources
Despite the poor documentation not noting this, there are work arounds described in the links above. Alternatives include using the, much longer named, ReloadableResourceBundleMessageSource and InputStreamReader classes.