I faced a problem that the Jackson2JsonDecoder
class always decodes content to UTF-8
charset, but I get content in iso-8859-1
and instead of viewing it correctly, I get unreadable chars.
For example, I recieve frühestens in iso-8859-1
and after Jackson2JsonDecoder I got frühestens.
I'm using spring boot 2.5.1 version.
I created custom Jackson2JsonDecoder
to getBytes in correct charset, but I'm not sure if this is the correct way. Maybe I don't understant basic coding stuff.
Jackson2JsonDecoder:
...
return decoded.map(s -> DefaultDataBufferFactory.sharedInstance.wrap(s.getBytes(StandartCharset.UTF_8)));
...
CustomJackson2JsonDecoder:
...
return decoded.map(s -> DefaultDataBufferFactory.sharedInstance.wrap(s.getBytes(charset)));
...
Can somebody correct me or explain why default Jackson2JsonDecoder
always getBytes only in UTF-8
Thank you!