My encoding is set to ISO-8859-1.
I am making an AJAX call using jQuery.ajaxfor a servlet. The URL (after it was serialized by jQuery) is as follows:
jQuery.ajax
https://myurl.com/countryAndProvinceCodeServlet?action=getProvinces&label=%C3%85land+Islands
The actual value of the label Åland Islands. When it comes to the servlet, the value I get is the following:
Åland Islands
Ã\u0085land Islands
But that is not what I want. I would like it to be decoded before Åland Islands. I tried a lot of things (setting scriptCharset, trying to convert a string using getBytes(), but nothing works).
scriptCharset
getBytes()
Servlet, , , . .
- , , , Servlet, UTF-8, ISO-8859-1. ( ISO-8859-1, Windows 1252, , , ISO-8859-1!)
, . Tomcat server.xml.
, , , / . , ISO-8859-1 , , , UTF-8, ISO-8859-1, , UTF-8. , - UTF-8, ...
HttpServletRequest#getQueryString()
String
URLDecoder#decode()
for (String parameter : request.getQueryString().split("&")) { String[] pair = parameter.split("="); String name = URLDecoder.decode(pair[0], "UTF-8"); String value = URLDecoder.decode(pair[1], "UTF-8"); // ... }
, , , .
Source: https://habr.com/ru/post/1771584/More articles:Providing an “open” web service without HTTPS or a private public key - securityhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1771580/is-there-a-way-to-pad-files-with-a-few-extra-bytes-to-get-a-different-md5-checksum&usg=ALkJrhheWNPAzfB4kCMqfRxsD-1DE6hUCACode Review: Effective? Will this work? - javascriptКак оптимизировать вызовы Castle ActiveRecord - activerecordИзвлечение столбцов текста из pdf файла с помощью iText - javaSlice binary number into groups of five digits - pythonСамый pythonic способ разрезать список Python каждые 100 элементов - pythonCan I please help a little to fix my little beginner project? - databaseCan I change the color of the notification bar? - androidSSIS XMLSource only sees null values in XML variable - sql-serverAll Articles