Encoding fail with HttpPost in Android

I've trying to get response from my php Api with HttpPost method - The API make SQL request for searching in database. This is my parameters as example

    // Example for param :
    nameValuePairs.add(new BasicNameValuePair("getProductFromOtherShops", "1"));
    nameValuePairs.add(new BasicNameValuePair("productName", name));

The problem is that i have product names with Bulgarian characters like "Бойлер Елдом" as example. When i put the name in my parameters , it doesn't reaches to the API. Help! Thanks previously!

Upvotes: 0

Views: 52

Answers (1)

flx
flx

Reputation: 14226

As far as I understand it, only ASCII chars are permitted: https://developer.android.com/reference/org/apache/http/message/BasicNameValuePair.html

Try encoding it with Base64 or escape non-ASCII before passing it to the server.

Upvotes: 1

Related Questions