我正在尝试在我的应用程序中允许多语言支持,它可以创建一个HTTP post来上传新消息。我需要做什么才能支持日语和其他非拉丁语语言?我的代码目前看起来像这样:
//note the msg string is a JSON message by the time it gets here...
private String doHttpPost(String url, String msg)
throws Exception {
HttpPost post = new HttpPost(url);
StringEntity stringEntity = new StringEntity(msg);
post.setEntity(stringEntity);
return execute(post);
}
发布于 2011-02-23 06:38:03
尝试在StringEntity上设置编码:
StringEntity stringEntity = new StringEntity(msg, "UTF-8");
https://stackoverflow.com/questions/5084462
复制相似问题