简体   繁体   中英

Remove hidden tags from php json data for android application

I have created json format data using php and it's showing like

"address":"8th Floor, \u200bTower  EN27  Sector 9  Salt Lake City  \u2013 700081  India",

I have used header('Content-Type: application/json; charset=utf-8'); and trying to remove using str_replace and preg_replace as well but unable to remove \​ characters.

If I echo my address value it's showing fine

8th Floor, ​Tower EN27 Sector 9 Salt Lake City – 700081 India

One of my friend fetching my json data in his android application.

Please suggest me how to fix this issue.thanks

I really don't know how to avoid those unicodes in the Result Json (PHP). But, I would like to suggest you to let android handle this.

txtResult = (TextView) findViewById(R.id.txtResult);
txtResult.setText(Html.fromHtml("8th Floor, \u200bTower  EN27  Sector 9  Salt Lake City  \u2013 700081  India"));

The Unicode can be removed by setting to the textview with the help of HTML class.

这是示例文本视图

I have tested this also. It is working really fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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