UNICODE TO UTF-8 issue while retrieve from server in android
<p>I am storing unicode in mysql database and trying to retrieve it using php in my android app. whenever i try to retrieve only unicode is coming not the utf-8 characters.I have specified encoding as  utf-8 in http and I searched a lot in net for solution ,but still does not found answer . i have used this also but still no luck.</p>

<pre><code>new String(json_data.getString("message").getBytes(""),"UTF-8")
</code></pre>

<p>below i am posting my code .any suggestions are welcome.my requirement is to get hindi,urdu or any language from server and i need to display.so what i am doing wrong.
and from database i am getting this \u0cb9\u0ccc \u0c85\u0cb0\u0cc6 \u0caf\u0cc1 </p>

<pre><code>private class BackgroundTask extends AsyncTask &lt;String, Void, String&gt; {
      @Override
protected String doInBackground(String... url) {
String result = "";
ArrayList&lt;NameValuePair&gt;   nameValuePairs = new ArrayList&lt;NameValuePair&gt;(5);
String prefName = "MyPref";
SharedPreferences prefs=getSharedPreferences(prefName,MODE_PRIVATE);
 nameValuePairs.add(new BasicNameValuePair("username", mname.getText().toString()));
 nameValuePairs.add(new BasicNameValuePair("password", mpassword.getText().toString()));
 nameValuePairs.add(new BasicNameValuePair("regid", regid));
 nameValuePairs.add(new BasicNameValuePair("status_id", "1"));
 nameValuePairs.add(new BasicNameValuePair("clienttype_id", "clienttype_id"));
        try {
      HttpClient httpclient = new DefaultHttpClient();
            Resources resources=getResources(); 
 String urlstr=String.format(resources.getString(R.string.androidexternal));

 HttpPost httppost = new HttpPost(urlstr);// for test db                  
 // Add your data
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8"));

              // Execute HTTP Post Request
              HttpResponse  response = httpclient.execute(httppost);

              inputStream = response.getEntity().getContent();

         }catch(Exception e){
             Log.e("log_tag", "Error in http connection "+e.toString());
     }
     //convert response to string
     try{//iso-8859-1,UTF-8
 BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream,"UTF-8"),8000);
             StringBuilder sb = new StringBuilder();
             String line = null;

             while ((line = reader.readLine()) != null) 
                  {
                sb.append(line + "\n");
             }
             inputStream.close();

             result=sb.toString();
     }catch(Exception e){
             Log.e("log_tag", "Error converting result "+e.toString());
     }
      if(result.contains("null")){

      } 
      else
      {
         try{
                    JSONArray jArray = new JSONArray(result);

                    for(int i=0;i&lt;jArray.length();i++)
                    {
                            JSONObject json_data = jArray.getJSONObject(i);

                   if(i&gt;=3){

System.out.println( new String(json_data.getString("message").getBytes(),"UTF-8"));

                         }

                    }
                   startActivity(intent); 

            }
             catch(JSONException e){
                    Log.e("log_tag", "Error parsing data "+e.toString());

            }  catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }  catch (IOException e) {

                e.printStackTrace();
            }

      }
   return result.toString();
  }
</code></pre>

<p>and server side code is </p>

<pre><code>// select query for login layout if(isset($_REQUEST['username']))
{

    $get_message_sql = mysql_query("SELECT `message`,`language` FROM doctor_custom_message WHERE  `client_id`='".$result['id']."' AND status='1' ");

 $number=mysql_num_rows( $get_message_sql);
   while($e=mysql_fetch_assoc($get_message_sql))
    if($number==0)
    {
        $output[]="null";

    }else{
          $output[]=$e;
          }

//header('content-type: text/plain; charset=utf-8');
    print(json_encode($output));

}// main brace closed
</code></pre>
