L
L
Loligan2016-05-24 22:42:21
Java
Loligan, 2016-05-24 22:42:21

Why does it crookedly translate from windows1252 to UTF-8?

In general, I'm trying to process the Cyrillic alphabet that I get from PathVariable. Judging by what the bugs were, I just have win-1252 (I'm on Ubuntu), all the code, including JSP, is marked as UTF-8, Maven also has UTF-8 encoding marked, and the encoding is also set in the Tomcat config UTF-8 but for some reason they don't send UTF-8 at all. Judging from the article on Habr, my type of crackers is win-1252. I tried to convert String from win-1252 to UTF-8 but it only translates part of the letters (see screenshot). I tried everything, including the translation from win-1251 to UTF-16 and various variations (I did not try the BOM). In general, below is the method. And in the screenshot, the variables during debugging, tried to send the word "Hi"

@RequestMapping(value = "/rename/{album_name}", method = RequestMethod.POST)
public ModelAndView renameAlbum(@PathVariable("album_name") String album_name, @RequestParam("new_album_name") String newAlbumName1252,RedirectAttributes attributes) throws Exception {
String newAlbumName = new String(newAlbumName1252.getBytes("windows-1252"),"UTF-8");

fbee27ed15d04c8f989f09441bc2de08.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#algooptimize #bottize, 2016-05-24
@user004

and see this
stackoverflow.com/questions/4470787/spring-rest-pa...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question