您好我正在Twitter客户端工作,当我撰写推文并以阿拉伯语或日语发布时它不接受它。为什么?
这是发布推文的方法:
public void postTweet(String body, AsyncHttpResponseHandler handler) {
Log.i(CLASS, "statuses/update.json");
String apiUrl = getApiUrl("statuses/update.json");
RequestParams params = new RequestParams();
params.put("status", body);
getClient().post(apiUrl, params, handler);
}
这是在点击发送按钮之后:
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TwitterClient client = RestApplication.getRestClient();
client.postTweet(tweet.getText().toString(), new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Toast.makeText(getActivity(), "Sent Successfully", Toast.LENGTH_LONG).show();
dismiss();
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.e(CLASS, "Error sending the tweet. Status: " + statusCode, error);
Toast.makeText(getActivity(), "Error sending the tweet, please try again.", Toast.LENGTH_LONG).show();
}
});
}
});
任何帮助,请
答案 0 :(得分:0)
您应该为它指定字符集:
试试这个:
ContentType.create("application/json", CharSet.forName("UTF-8"));