0

Hello I'm working on a Twitter client and when I compose a tweet and post it in arabic or japanese It doesn't accept it. why ?

That's method to post a tweet :

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);
}

and that's after clicking on send button :

  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();
                }
            });
        }
    });

any help please

Adarsh Yadav
  • 3,752
  • 3
  • 24
  • 46
TREAF ALSHEMERI
  • 409
  • 5
  • 12

1 Answers1

0

You should specify charset for it :

try this :

ContentType.create("application/json", CharSet.forName("UTF-8"));
l3est
  • 407
  • 2
  • 4
  • 16