简体   繁体   English

Android / Iphone的PHP后端-特殊字符问题

[英]PHP backend for Android / Iphone - Special character issue

We are using PHP as backend for mobile application (in both Android and IPhone). 我们正在将PHP用作移动应用程序的后端(在Android和iPhone中)。 From mobile we will hit the backend to get the record listings in xml format (same for both android and iphone) from php. 从移动设备开始,我们将在后端访问以从php获取xml格式的记录列表(Android和iPhone都相同)。

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. 因此,首先我们从iphone进行了测试,发现某些字符无法正确显示,然后在mysql_charset中将字符集更改为UTF-8。 After that it was working fine in IPhone. 之后,它在iPhone中运行良好。 But there was problem in retreiving records from Android. 但是从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'); 我们已经使用了xmlencoding,因为utf-8还添加了'header('Content-Type:text / xml; charset = utf8'); ' '

If there is any other solution compatible for both Iphone and Android, please let me know. 如果还有其他适用于Iphone和Android的解决方案,请告诉我。

Characters which we will be using are ä, å, é, ö. 我们将使用的字符是ä,å,é,ö。

Thanks in Advance, 提前致谢,

Regards 问候

Srini 斯里尼

on this website you find all HEX codes of every special character. 在此网站上,您可以找到每个特殊字符的所有十六进制代码。 http://www.ascii.cl/htmlcodes.htm http://www.ascii.cl/htmlcodes.htm

In Android (Java) you display special characters like this view.setText("hello\!"); 在Android(Java)中,您显示特殊字符,例如view.setText("hello\!"); for hello! hello!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM