I have a Spring form wih some validations and all the personalized messeges from javax.validation.constraints appears to use the wrong encoding.
Lets take this as an example:
@NumberFormat(style=Style.NUMBER)
@NotNull
private BigDecimal maintenanceCosts;
With applicationContext.xml file containing
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="defaultEncoding" value="UTF-8" />
<property name="basenames">
<list>
<value>classpath:messages</value>
<value>classpath:ValidationMessages</value>
</list>
</property>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
And a ValidationMessage_en.properties encoded in UTF-8 and marked so (in Eclipse with right click, properties) with the text:
javax.validation.constraints.NotNull.message=This field can't be empty
I want to show thouse messages in localized strings with the right codification so I added an UTF-8 file ValidationMessages_ru.properties with:
javax.validation.constraints.NotNull.message=Это поле не может быть пустым
But the message shows this message: Ðто поле не может быть пуÑтым
On the other hand I has able to customize the spring managed error messages with the right encoding. But JSR303 texts seems to behave differently.