我正在使用 Android 将英语和阿拉伯语内容发送到 Servlet,但数据会发送到服务器。如何解决?这是我在 Android 中的代码:
StringEntity se = new StringEntity(gsonString);
se.setContentType("text/json;charset=UTF-8");
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json;charset=UTF-8"));
HttpPost httpRequest = new HttpPost(methodURL);
httpRequest.setEntity(se);
HttpResponse response = httpClient.execute(httpRequest,localContext);
小服务程序代码
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
String line = in.readLine();
String gsonString = line;
while (line != null) {
gsonString += line;
line = in.readLine();
}
有什么建议么 ?