erde
- Forum posts: 13
Feb 11, 2014, 4:48:27 PM via Website
Feb 11, 2014 4:48:27 PM via Website
Hello, droidlers.
Suddenly ( I did not change anything in my code, really ). The utf-8 decoding seems not to work.
I updatrd JUNO and java two last days, ok, I changed min and target os version to 4.0.
And this here worked on friday, but today does not:
What is the issue ?
Suddenly ( I did not change anything in my code, really ). The utf-8 decoding seems not to work.
I updatrd JUNO and java two last days, ok, I changed min and target os version to 4.0.
And this here worked on friday, but today does not:
1urlTarget = new URL(this._strBaseUrl);
2 webRequest = (HttpURLConnection)urlTarget.openConnection();
3
4 webRequest.setConnectTimeout(300000);
5 webRequest.setReadTimeout(290000);
6 webRequest.setRequestMethod("POST");
7 webRequest.setRequestProperty("Accept-Encoding","gzip,deflate");
8 webRequest.setRequestProperty("Remote-Device",this._strDevice);
9 webRequest.setRequestProperty("Accept","*/*");
10 webRequest.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
11 webRequest.setRequestProperty("Accept-Charset", "UTF-8");
12 webRequest.setRequestProperty("Connection", "keep-alive");
13
14 String strCommandLine = "";
15 int intCount = 0;
16
17 for (String string :paramsToTarget) {
18 if (intCount > 0){
19 strCommandLine = strCommandLine.concat(String.valueOf('¦'));
20 }
21 strCommandLine = strCommandLine.concat(string);
22 intCount++ ;
23 }
24
25 if (this._strCookieString != null ){
26 webRequest.setRequestProperty("Cookie",this._strCookieString);
27 }
28
29 ByteBuffer bb = charsetUTF8.encode(strCommandLine);
30
31 webRequest.setRequestProperty("Content-Length","" + bb.array().length);
32
33
34 webRequest.setDoInput(true);
35 webRequest.setDoOutput(true);
36 wr = new DataOutputStream(webRequest.getOutputStream());
37 wr.write(bb.array());
38 wr.flush();
39 intResponse = webRequest.getResponseCode();
40 wr.close();
41
42 is = webRequest.getInputStream();
43 br = new BufferedReader(new InputStreamReader(is,"utf-8"));
44 strBufResponse = new StringBuffer();
45
46 while ((strLine = br.readLine()) != null){
47 strBufResponse.append(strLine);
48 strBufResponse.append('\r');
49 }
2 webRequest = (HttpURLConnection)urlTarget.openConnection();
3
4 webRequest.setConnectTimeout(300000);
5 webRequest.setReadTimeout(290000);
6 webRequest.setRequestMethod("POST");
7 webRequest.setRequestProperty("Accept-Encoding","gzip,deflate");
8 webRequest.setRequestProperty("Remote-Device",this._strDevice);
9 webRequest.setRequestProperty("Accept","*/*");
10 webRequest.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
11 webRequest.setRequestProperty("Accept-Charset", "UTF-8");
12 webRequest.setRequestProperty("Connection", "keep-alive");
13
14 String strCommandLine = "";
15 int intCount = 0;
16
17 for (String string :paramsToTarget) {
18 if (intCount > 0){
19 strCommandLine = strCommandLine.concat(String.valueOf('¦'));
20 }
21 strCommandLine = strCommandLine.concat(string);
22 intCount++ ;
23 }
24
25 if (this._strCookieString != null ){
26 webRequest.setRequestProperty("Cookie",this._strCookieString);
27 }
28
29 ByteBuffer bb = charsetUTF8.encode(strCommandLine);
30
31 webRequest.setRequestProperty("Content-Length","" + bb.array().length);
32
33
34 webRequest.setDoInput(true);
35 webRequest.setDoOutput(true);
36 wr = new DataOutputStream(webRequest.getOutputStream());
37 wr.write(bb.array());
38 wr.flush();
39 intResponse = webRequest.getResponseCode();
40 wr.close();
41
42 is = webRequest.getInputStream();
43 br = new BufferedReader(new InputStreamReader(is,"utf-8"));
44 strBufResponse = new StringBuffer();
45
46 while ((strLine = br.readLine()) != null){
47 strBufResponse.append(strLine);
48 strBufResponse.append('\r');
49 }
What is the issue ?
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.