Spring mvc -Properties file encoding

I have a problem reading some character in a property file in Spring MVC.

I know properties file are encoded in ISO-8859-1 so I set my messageSource bean to set the default encode to UTF-8

    public MessageSource messageSource() {
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
        return messageSource;

Before this modification, for example I saw the à character as �, after the à became ?

I've also tried to use ReloadedResourceBundleMessageSource with no effect

How can I display just à?


the javadoc states the following:

Characters that cannot be directly represented in this encoding can be written using Unicode escapes as defined in section 3.3 of The Java™ Language Specification; only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings. Source here

I been using that approach when I work with the ISO-8859-1 encoding (For example: number=N\u00famero) for a while but now I use the ReloadedResourceBundleMessageSource like you describe and it works flawlessly, as far I can know your properties file should be encoded using UTF-8 as well, you could try to encode your file using native2ascii like this example:

native2ascii -encoding UTF-8 file1.properties file2.properties

Need Your Help

Metaio SDK (AREL) - how to show image content without tracking?

arel metaio

I have just simple rectangle button realized as image content and i wanna to show it on screen without any tracking and without using screen anchors.

How to register a new MIB module?

snmp mib

For those who have tried using the net-snmp library, how do you add a new mib module?