I need to use "ö", "ä". "Ü" in my program, but java / android will not let me

I need my program to send a request to the server. The problem is that the server only recognizes ös, äs und üs, but JAVA and / or Android do not know them. `How can I send a request using String like“ Hermann-Löns ”without JAVA / Android“ change ”ö .... Oh and by the way. "Oe" is also not recognized by the server, have already tried this ...

thanks for reference!

@BalausC:

I changed your code to:

I'm not sure if you are referring to the correct fields this way ...

String url = "http://busspur02.aseag.de/bs.exe?SID=473A2&ScreenX=1440&ScreenY=900&CMD=CR&DatumT=30&DatumM=4&DatumJ=2010&AbfAnk=Abf&ZeitH=10&ZeitM=45&Intervall=60&Loeschen=%28N%29eue+Suche";
        String charset = "CP1252";
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("HTO", start_from));
        params.add(new BasicNameValuePair("HT1", destination));
        UrlEncodedFormEntity query = new UrlEncodedFormEntity(params, charset);

            HttpPost post = new HttpPost(url);
            post.setEntity(query);
            InputStream response = new DefaultHttpClient().execute(post).getContent();
            // Now do your thing with the facebook response.

I cannot compile because I get an error message:

GetContent () method - undefined for type HttpResponse

If I remove getContent (), it says:

Type mismatch: cannot convert from HttpResponse to InputStream

: htmlparser (http://htmlparser.sourceforge.net/), -. html ? , .

+3
1

java.net.URLEncoder .

String param = URLEncoder.encode("Hermann-Löns", "CP1252");

, HTTP- Accept-Charset: CP1252. , HTTP- , , . HttpClient, Android.

+4

Source: https://habr.com/ru/post/1743391/


All Articles