1

I have a spring boot application and I use IntelliJ IDEA and everything is fine.

But when I run the application using the command line I face one problem with the UTF-8 encoding which converts all the text of a different language than English to non-understandable symbols as you can see in the photo below.

I guess the problem is that the UTF-8 encoding is untenable while when I use IntelliJ IDEA I don't face this problem.

I run the application using:

mvn spring-boot:run

and I added this option but still not working

mvn spring-boot:run -Dfile.encoding=UTF-8

I updated the properties file also, but no difference

server.servlet.encoding.charset=UTF-8
server.tomcat.uri-encoding=UTF-8

Is there a specific way to enable the UTF-8 encoding, so the text will show in the right language?

enter image description here

1
  • Have you correctly configured your sources setup accordingly? Do use message properties? Correctly handling that case? Which JDK you are running on ? Commented Jan 30, 2022 at 16:16

1 Answer 1

3

Well, this plugin solved the problem

  <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
      <executable>true</executable>
      <jvmArguments>-Dfile.encoding=UTF8</jvmArguments>
    </configuration>
  </plugin>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.