Search code examples
androidparsingdictionarytextviewspecial-characters

Special charaters show square box in webservice response


Here is the word pronounciation coming in my web services response tækˈsɑ:nəmi but when i show it android textview it shows like this tækËsÉ:nÉmi And also sometime it shows Square boxes in place of some characters when i show it in android textview.

Please guide or suggest some solution.

Ali


Solution

  • I have found the way to solve this after consulting with a genius guy.

            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type",
                    "application/x-www-form- urlencoded");
            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
    

    Here is the magical line of code.

            xml = EntityUtils.toString(httpEntity, HTTP.UTF_8);
    

    Cheers. Ali