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

  • Home
  • SEARCH
  • 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 6214081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:48:47+00:00 2026-05-24T06:48:47+00:00

I am currently developing an Android app that is using a remote MySQL database

  • 0

I am currently developing an Android app that is using a remote MySQL database to write/read bookmarked by the user locations on the map. I acquire the address of a location via Reverse GeoLocation and after that pass it to a php file with the following code:

EditText addressEntry = (EditText) findViewById(R.id.addressentry);
String address = addressEntry.getText().toString().trim();
nameValuePairs.add(new BasicNameValuePair("address", address)); 

Here is my php file:

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head> 
<body>
    <?php
    $mysqlid = mysql_connect("XXX","XXX","XXX");
    mysql_select_db("XXX");
    mysql_query("SET NAMES utf8", $mysqlid) ;

    $insert_query = mysql_query("INSERT INTO table123 (userid, address) VALUES ('".$_REQUEST['userId']."', '".$_REQUEST['address']."') ");

    mysql_close();
    ?>
</body>
</html>

If I submit an address that contains no-Cyrillic letters everything works fine – I get the record in the database. But if I submit a Cyrillic entry – I get the following record in the database :

.  13A
Sofia

Where every (it’s a rectangle-symbol but not shown here – copy-pasted appears like this – ?) is a letter from the actual address. Before submitting the address to the database I have a toast showing it and it appears to be valid and readable.picture of the valid address shown

Here is my code connecting the remote database:

public void onClick(View addBookmarkView) {
                InputStream is = null;

                ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                nameValuePairs.add(new BasicNameValuePair("userId", userIdPassed));
                EditText addressEntry = (EditText) findViewById(R.id.addressentry);
                String address = addressEntry.getText().toString().trim();
                nameValuePairs.add(new BasicNameValuePair("address", address));

                //http post
                try{
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost(PHP_URL);
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response = httpclient.execute(httppost);
                    HttpEntity entity = response.getEntity();
                    is = entity.getContent();
                } catch(Exception e){
                    Log.e("log_tag", "Error in http connection "+e.toString());
                }

I am sure the error is not in my database nor the php file – the sql database it has an Collation set to utf8_general_ci and if I try to put a static Cyrillic entry via another php file it works fine. Here the example:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head> 
<body>
    <?php
    $mysqlid = mysql_connect("XXX","XXX","XXX");
    mysql_select_db("XXX");
    mysql_query("SET NAMES utf8", $mysqlid) ;

    $insert_query = mysql_query("INSERT INTO table123 (userid, address) VALUES ('123456789','асдсдасдас 123') ");

    mysql_close();
    ?>
</body>
</html>

And this successfully adds a valid and readable in Cyrillic record in my database.

асдсдасдас 123

Do you have any idea if I miss to put something to specify encoding somewhere in the Android app code or maybe Manifest.xml or any other idea how to get this running?
Cheers!

  • 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-05-24T06:48:48+00:00Added an answer on May 24, 2026 at 6:48 am

    Try to set the encoding for Cyrillic entries using this:

    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8")); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing an Android app that is supposed to inform the user
I'm currently developing an Android application that fetches images using http requests. It would
I am currently developing a Rails application using a database that was designed before
I'm currently developing a PHP application that's using an Access database as a backend.
A new question about android and services. Currently I'm developing a App that should
I am currently developing an application that receives GPS data gathered using and android
I have an Android app that I am currently developing. I have created icons
I am currently developing an approval routing WCF service that will allow an user
I'm currently developing my first android app, and my first game. I've been developing
I am currently developing an android application uses Google map API. I am wondering

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.