Japanese characters described in MessageResources.properties are garbled
Premise
Spring Validation message is garbled.
- Production environment, etc.
- When executed in Eclipse, it is displayed normally.
problem
This page deals with the case of violating "the properties file must be unicode (ISO-8859-1 in Eclipse) encoded."
In Spring, the properties file read through the Spring api is not created with the assumption that it will read multi-byte characters, so it must be in the above encoding method.
solution
1. Change the encoding method of the Eclipse editor
*** (Caution) Back up the contents of MessageResources.properties before making changes ***
- From Eclipse's Package Explorer, right-click MessageResources.properties
- Click Properties
- Resources → Text File Encoding → Other: Select ISO-8859-1
- Apply and close, click
2. Rewrite the file
- From Eclipse's Package Explorer, right-click MessageResources.properties
- Next → Click Limy Property Editor
- If the characters are garbled, rewrite them (from backup to copy, etc.).
- Save
3. The error display becomes Japanese
--By the above, the file is displayed in Japanese on Eclipse and the character encoding method is ISO-8859-1.