Since Grails 3.2.8 (and above) the resource bundle within my application does not work as expected. German umlauts (or general UTF-8 chars that are not part from ASCII) are display with ��. E.g. the German word über is displayed as ��ber.
First I suspected the processResources
Gradle tasks that performs native2ascii
. But my UTF-8 resource bundle files are properly copied to build/resources/main/*.properties
and converted to US-ASCII
.
The source file is clearly encoding using UTF-8.
file -I grails-app/i18n/messages_de.properties
grails-app/i18n/messages_de.properties: text/plain; charset=utf-8
after running ./gradlew clean processResources
all the resource bundle files are successfully processed by native2ascii
and encoded using US-ASCII
.
file -I build/resources/main/messages_de.properties
build/resources/main/messages_de.properties: text/plain; charset=us-ascii
All non ASCII chars are escaped.
event.free.space={0,number} von {1,number} verf\u00fcgbar
While debugging my application running as a standalone WAR using
java -jar -server -Dserver.address=127.0.0.1 -Dserver.port=50000 \
-Dgrails.env=prodMySQL -Djava.security.egd=file:/dev/./urandom \
-Xmx768M -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 \
build/libs/my.war
I noticed that the org.grails.spring.context.support.PluginAwareResourceBundleMessageSource
loads my messages_de.properties
file using UTF-8 encoding since it logs the following message.
s.PluginAwareResourceBundleMessageSource : Loading properties [messages_de.properties] with encoding 'UTF-8'
After loading the properties file into to the a java.util.Properties
class, I see all non ASCII characters as e.g. �.
Any clue whats going wrong here?