Incorrect display of logs in Cyrillic in Logbook

1.2k Views Asked by At

At the moment, Logbook logs requests and responses in the wrong encoding (ISO-8859-1 instead of UTF-8), which is why the Cyrillic alphabet is displayed incorrectly.

{"message":"ÐÐ¾Ð¼ÐµÑ ÑелеÑона должен бÑÑÑ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½}

Currently (library version 2.3.0), the log text is generated in org.zalando.logbook.DefaultHttpLogFormatter#format(org.zalando.logbook.Correlation, org.zalando.logbook.HttpResponse), where org is eventually called.zalando. logbook.servlet. LocalResponse#getCharset, which returns ISO-8859-1 encoding instead of UTF_8.

How do I change the encoding? How do I configure this?

1

There are 1 best solutions below

0
Ильяс Шарипов On

I am using spring boot, I had the same problem and these lines in the application.yml helped me:

  1. For spring boot version below 2.3.0 spring.http.encoding.charset = UTF-8 and spring.http.encoding.force-response = true
  2. For spring boot version higher than 2.3.0 server.servlet.encoding.charset = UTF-8 and server.servlet.encoding.charset.force-response = true