Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:16:25+00:00 2026-06-13T19:16:25+00:00

I have a string coming from an XML file that appears to have been

  • 0

I have a string coming from an XML file that appears to have been encoded with htmlspecialchars() twice:

$data = "string,s example";

I’ve tried replacing & with just an amphersand, then calling htmlspecialchars_decode(), and then replacing simple amphersands with the word “and”, but the output comes out like stringand#44; example.
I’m wondering if there is a way to correctly convert these character encodings, or perhaps a regex to strip them out entirely (as i could simply strip them and use this as a value to check against later)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:16:26+00:00Added an answer on June 13, 2026 at 7:16 pm

    This particular string needs to be processed twice by html_entity_decode to get its “real” value (the first of these calls can also be htmlspecialchars_decode). The first pass will convert & to & and the second will convert the entity , to the corresponding character.

    You should be careful to pass in all relevant parameters to the decoding function calls (the defaults don’t make sense in all cases) and of course be sure that all of the incoming data is encoded in this manner so that you don’t get broken output by mistake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that I have parsed from XML using Google's GDataXML parser,
I have a large amount of data that I am pulling from an xml
I have a string that is coming from DB. I would like to read
I have a string value coming from a label in the .aspx page as
I have string that look like Array that fetched from other webservice like this
I have string that displays UTF-8 encoded characters, and I want to convert it
I have the following JSON string coming from external input source: {value: "82363549923gnyh49c9djl239pjm01223", id:
I have been working with WPF all of 2 days, coming from ASP.NET so
I have some problems in writing down the schema of my XML file, that
My issue is to display file coming from a XML Response on the iPhone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.