[JAVA] Japanese characters described in MessageResources.properties are garbled

Premise

Spring Validation message is garbled.

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 ***

  1. From Eclipse's Package Explorer, right-click MessageResources.properties
  2. Click Properties
  3. Resources → Text File Encoding → Other: Select ISO-8859-1
  4. Apply and close, click 1.jpg

2. Rewrite the file

  1. From Eclipse's Package Explorer, right-click MessageResources.properties
  2. Next → Click Limy Property Editor
  3. If the characters are garbled, rewrite them (from backup to copy, etc.).
  4. 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.

Recommended Posts

Japanese characters described in MessageResources.properties are garbled
Fix garbled characters in SceneBuilder 11
How to fix garbled Japanese characters in JAVA (including Arduino IDE)
How to fix garbled Japanese characters in JAVA (including Arduino IDE)
[Docker] Input initial data to docker-entrypoint-initdb.d without mounting the directory [MySQL]
Japanese characters described in MessageResources.properties are garbled
Umlaut garbled characters
About characters that are completed in method arguments
Measures against garbled characters in Multipart Request with Quarkus
[JavaServlet] Summary of correspondence when Japanese parameters are garbled
Zip compression with Java in Windows environment without garbled characters
Check when double-byte characters are garbled when storing the information acquired by API etc. in the MySQL database.