Srinivasan
Srinivasan

Reputation: 443

PHP backend for Android / Iphone - Special character issue

We are using PHP as backend for mobile application (in both Android and IPhone). From mobile we will hit the backend to get the record listings in xml format (same for both android and iphone) from php.

We have special characters in the database in some fields (swedish characters). From mobile we will pass the search text which user keys in and display the records accordingly. So first we tested from iphone, there was some characters not displayed properly and then we changed charset to UTF-8 in mysql_charset. After that it was working fine in IPhone. But there was problem in retreiving records from Android. When we input text which has special characters, then the expected result was not displayed. But when we search from the browser , results are displayed normally.

We have used the xmlencoding as utf-8 also added 'header('Content-Type: text/xml; charset=utf8'); '

If there is any other solution compatible for both Iphone and Android, please let me know.

Characters which we will be using are ä, å, é, ö.

Thanks in Advance,

Regards

Srini

Upvotes: 1

Views: 674

Answers (1)

Mats Hofman
Mats Hofman

Reputation: 7240

on this website you find all HEX codes of every special character. http://www.ascii.cl/htmlcodes.htm

In Android (Java) you display special characters like this view.setText("hello\u0021"); for hello!

Upvotes: 1

Related Questions