Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7737489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:00:47+00:00 2026-06-01T08:00:47+00:00

I want to get some text from a PHP page into an Android application.

  • 0

I want to get some text from a PHP page into an Android application. As long as the characters are ASCII (up to 128) there’s no problem but when I want to display special characters like ‘Ţ’, ‘Â’ (the so called Latin-1 Supplement and/or Latin Extended-A – see it at Unicode Chart)
I get weird symbols into my Android application (�).

The problem is that my Android application cannot handle characters from Latin-1 Supplement (which PHP can) but characters from the Latin Extended-A charset (which PHP cannot). I don’t know what common charset for both languages to use because the one that Java is able to read PHP is not, and vice versa.

My Java function that gets the content of the PHP page is this:

public static String GetData() {
    byte[] Bresult = null;
    HttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost("http://www.mypage.com/script.php");
    try {
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
        nameValuePairs.add(new BasicNameValuePair("var", "val"));
        post.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
        HttpResponse response = client.execute(post);
        StatusLine statusLine = response.getStatusLine();
        if(statusLine.getStatusCode() == HttpURLConnection.HTTP_OK){
            Bresult = EntityUtils.toByteArray(response.getEntity());
            Result = new String(Bresult, "UTF-8");
        }
    } catch (UnsupportedEncodingException e) {
        Log.w("MYAPP", "Unsupported Encoding Exception (" + e.getMessage() + ")");
    } catch (Exception e) {
        Log.w("MYAPP", "Exception (" + e.getMessage() + ") ocurred");
    }
    return Result;
}

So, this code gives me the content of the script.php page. If the characters of the text received are from 0 to 128 there is no problem. Elsewhere, I get weird characters.

Now, this is my PHP code:

<?php
    header("Content-Type: text/plain;charset=utf-8");
    echo "ÂŞÂĂĒ";
?>

I also have a C++ application and it does read the text correctly. I have been trying a lot of methods all the day and I just don’t get it. Who, where, why?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:00:48+00:00Added an answer on June 1, 2026 at 8:00 am

    where are you getting the data?, if is through a mysql database you must specify UTF8 like this

    mysql_query("SET NAMES 'utf8'");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get some text from php file and display on a browser
Hi all.. I want to get some information from my database and show into
I want to apply some CSS to text that I can't get marked up
I want to get some images from a movie and make a gif. What
I want to get some images from a flash webpage and I got the
I am using http://lite.facebook.com And i want to get some data from my account.
I have one problem , I want to get some data from XML file
i m using jQuery.get() to delete row from a table from a page main.php
I am having some issues returning data from on page, using jQuery, PHP and
Goal: I want to get the text from the selected element and then create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.