1

I have an array of strings coming back from a web service that are encoded like this:

"Women\x27s Health"

I have not been able to convert "\x27" to an apostrophe in PHP. I've tried

html_entity_decode('Women\x27s Health", ENT_QUOTES, 'UTF-8') 

and a few other solutions outside of a find an replace is there a way to do this?

4
  • What format is the data coming back to you in? Commented Feb 22, 2017 at 19:19
  • JSON - the comment below worked for me. Commented Feb 22, 2017 at 19:25
  • Whoever is providing this data is not doing it correctly. Apostrophes don't need to be escaped. If they did, they should be done like \u0027, which would then get handled by json_decode() automatically. Commented Feb 22, 2017 at 19:28
  • It's our google search appliance. It probably has a setting somewhere to change how it's returning the data. I'll take a look. Thanks for your input. Commented Feb 22, 2017 at 23:40

1 Answer 1

2

It's not really "encoded" ... Just apply stripcslashes().

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.