Subscribe for updates on posts
Be the first to read the latest news

End to end UTF-8 encoding usage with MySql and Spring – Part 2

September 1st, 2006 by Ioan Cocan in Java, General

One thing I forgot to mention was the usage of Spring message bundles. Usually, a ResourceBundleMessageSource is configured to inject bundle messages for Spring MVC. The only bad thing is that I could not specify an encoding for the configured message.properties files. As the default properties format is ISO 8859-1 character encoding and tedious operations like transformation of Unicode characters using native2ascii tool is necessary, I looked for a way to load UTF-8 resource files without any transformations. Spring has a ReloadableResourceBundleMessageSource class that allows just that, along with the reloadable behaviour. The bundle configuration now looks:

<bean id=”messageSource” class=”org.springframework.context.support.ReloadableResourceBundleMessageSource”>

<property name=”basename”>

<value>/WEB-INF/classes/messages</value>

</property>

<property name=”defaultEncoding”>

<value>UTF-8</value>

</property>

<property name=”cacheSeconds”>

<value>-1</value>

</property>

</bean>


You might also like

End to end UTF-8 encoding usage with MySql and Spring Setting up a solution to store, manage and display UTF-8 data using MySql was quite a challenge.There...
Spring+JPA with MySQL/Oracle configurations During development for a solution based on Spring+JPA+MySQL/Oracle we came across two settings to...
My experience with web services with Spring, Axis, XFire First thing to note is that, this being my first contact with web services (SOAP and WSDL), it took me...
MySql, PHP and UTF8 Nowadays UTF8 is far from being just "trendy", it's the de facto standard for information representation....
.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.