Hi!
When trying to read a string containing non-english chars from a property file using getMessage() in ReloadableResourceBundleMessageSource, an encoding problem seems to occur.
The property file messages.properties is encoded using ISO-8859-1 and contains
In my SimpleFormController, I use the following code to get the message from the property file:Code:footer.message.eventsFound={0} körningar funna
The result from getMessage() is "11 körningar funna"Code:ReloadableResourceBundleMessageSource msgSrc = new ReloadableResourceBundleMessageSource(); msgSrc.setDefaultEncoding("ISO-8859-1"); msgSrc.setBasename("messages"); ... String s = msgSrc.getMessage( "footer.message.eventsFound", new Object[]{new Integer(eventList.size())}, request.getLocale() )
Note that this encoding problem only occurs when trying to access the property file from the Controller code! When accessing it directly from the JSP, using
it all looks fine! How come I get encoding problems in the Controller but not in the JSP?Code:<spring:message code="footer.message.eventsFound"/>
I've tried to use a simple ResourceBundleMessageSource as well, but with the same, disappointing result!
Has anyone run into a similar problem? All tips are really appreciated!
Thanks!
Regards,
Jacob


Reply With Quote