If in a similar request to the site Russian characters are transmitted, then they appear on the site as question marks.

To transfer Russian characters, do I need to create a table of correspondences for recoding, or is there a more elegant solution?

try (CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build()) { URI u = new URIBuilder() .setScheme(SCHEME) .build(); HttpPost httpPost = new HttpPost(u); List < NameValuePair > nvps = new ArrayList < > (); nvps.add(new BasicNameValuePair("subject", "какаф нибудь фраза")); } 

the site itself encodes ismoves so% C0% C2%, etc.

Aa-C0 | E0, Bb-C1 | E1, Bb-C2 | E2, Gg-C3 | E3, Dd-C4 | E4, Ee-C5 | E5, Eo-A8 | B8, LJ-C6 | E6, 3– C7 | E7, AI-C8 | E8, YY-C9 | E9, QC-CA | EA, LL-CB | EB, Mm-CC | EC, HH-CD | ED, OO-CE | EE, Pp-CF | EF, PP-D0 | F0, Cc-D1 | F1, Tm-D2 | F2, Yy-D3 | F3, Ff-D4 | F4 ... Xx-D5 | F5, Tsts-D6 | F6, Hh-D7 | F7, Шш-D8 | F8, ЩЩ-D9 | F9, Ъъ-DA | FA, Ыы-DB | FB, Ь-DC | FC, Ээ-ДД | FD, Юю-DE | FE, Яя-DF | FF

  • Do you want to POST the data as application/x-www-form-urlencoded ? Make sure that "\u0444\u0440\u0430\u0437\u0430" and "фраза" same in your case (the source code .java in the expected encoding is saved). In general, it is difficult to determine formally what encoding the server expects . I'm not familiar with the features of the Java http client, but perhaps its default behavior is already enough. If not, then explicitly httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); the desired encoding: httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); - jfs
  • Please note that the source code encoding has nothing to do with the encoding expected by the server. - jfs

0