简体   繁体   English

从php json数据中为Android应用程序删除隐藏标签

[英]Remove hidden tags from php json data for android application

I have created json format data using php and it's showing like 我已经使用php创建了json格式的数据,并且显示为

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

I have used header('Content-Type: application/json; charset=utf-8'); 我已经使用了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. 并尝试同时使用str_replacepreg_replace删除,但无法删除\\ u200b字符。

If I echo my address value it's showing fine 如果我回显我的地址值,则显示正常

8th Floor, ​Tower EN27 Sector 9 Salt Lake City – 700081 India 盐湖城9号楼EN27塔楼8楼– 700081印度

One of my friend fetching my json data in his android application. 我的一位朋友在他的android应用程序中获取我的json数据。

Please suggest me how to fix this issue.thanks 请建议我如何解决此问题。谢谢

I really don't know how to avoid those unicodes in the Result Json (PHP). 我真的不知道如何避免在Result Json(PHP)中使用那些unicode。 But, I would like to suggest you to let android handle this. 但是,我建议您让android处理。

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. 可以通过在HTML类的帮助下将其设置为textview来删除Unicode。

这是示例文本视图

I have tested this also. 我也对此进行了测试。 It is working really fine. 运行正常。

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

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