Reputation: 173
We are sending HTTPURLRequest to server.
When we are sending English content its working fine.But, when we are sending Arabic language content we are getting
Server returned HTTP response code: 500
We had written below code
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
connection.setRequestProperty("Content-Length", "" + Integer.toString(SendRequest.getBytes().length));
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
DataOutputStream dataout = new DataOutputStream(connection.getOutputStream());
dataout.writeBytes(SendRequest);
dataout.flush();
dataout.close();
BufferedReader bufferreader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
When I use connection.getInputStream()
I am getting 500 error
We are using utf-8 also.But, still getting the error
can any one help me
Upvotes: 0
Views: 362
Reputation: 33726
You can use a library to escape the special chars:
StringEscapeUtils.escapeJava("هولاء كومو")
This class is available on: Commons Lang from Apache
Hope this helps!
Upvotes: 1
Reputation: 81
Check the HTTP Status Response Codes. An error happened on the server, so the diagnostics will need to be performed on the server, not on the client.
Upvotes: 0