0

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 \u200b 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

2
  • \u200b is a zero width space so depending on where to are getting your data from you could trim or replace it before it enters the json Commented Mar 24, 2014 at 5:21
  • Not working.... already checked. Commented Mar 24, 2014 at 5:56

1 Answer 1

1

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.

Here is the sample textview

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.