L
L
leksoQA2017-07-18 16:25:55
Java
leksoQA, 2017-07-18 16:25:55

Why is the Russian text distorted when reading from a JSON file?

Good afternoon.
When reading from a JSON file, the Russian text is distorted. And if you run the program from Intellij Idea, then everything is fine. If from the terminal on the Maven command line then the text is garbled.
I understand that somewhere there are problems with the encoding, but I have not yet found how to fix the solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2017-07-18
@leksoQA

Try setting the encoding when reading the file:

InputStreamReader in = new InputStreamReader(new FileInputStream(filePath), "UTF8"));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question