I am using Spring ResourceBundle to retrieve message bundle from my .properties file. It constains special european characters like so:
Ü, ß. ä, ö, ü
MessageSouce bean is as below (I am making sure UTF-8 encoding is followed)
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:/META-INF/i18/messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
When I try to retrieve the message in my Java code I am getting Junk characters.
If I use below code, it helps to recognize few characters, but rest are still showing as ??
return new String (bundleString.getBytes(), "UTF-8")
Then I used below to encode my properties file, but still no effect
native2ascii -encoding utf8 resources.utf8 resources.properties
I also tried to manually open my properties file in Notepad++ and set UTF-8 encode, but no effect. I see a post here, having exact same problem as mine. But the solution uses PropertiesBundle, whereas I have to use Spring based solution only. However even the accepted answer in that link is not working for me, and giving junk characters.
Please suggest any possible solution.