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 6343669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:29:24+00:00 2026-05-24T20:29:24+00:00

I need to get an XML file from some CRM software. The XML file

  • 0

I need to get an XML file from some CRM software.

The XML file encoding is in UTF-8, but some “strange” characters are present, and I can’t parse the file with simple_xml due to these characters.

For example:

<ROW ART_LIB="CAT NxA1 2008"  />

the “xA1” char is present. What is it, and how do I encode it to the “good” character?

The good result to be parsing is:

<ROW ART_LIB="CAT N° 2008"  />

So, actually, to parse the XML file, I do that:

$fichier = utf8_encode(file_get_contents($inputfileName));
$xmlInput = simplexml_load_string($fichier);

How can I fix it?


Thanks to the help of Jason Coco, I’ve fix the problem to do it:

function mac_roman_to_iso($string)
{
    return strtr($string,
        "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa1\xa4\xa6\xa7\xa8\xab\xac\xae\xaf\xb4\xbb\xbc\xbe\xbf\xc0\xc1\xc2\xc7\xc8\xca\xcb\xcc\xd6\xd8\xdb\xe1\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf1\xf2\xf3\xf4\xf8\xfc\xd2\xd3\xd4\xd5Ð",
        "\xc4\xc5\xc7\xc9\xd1\xd6\xdc\xe1\xe0\xe2\xe4\xe3\xe5\xe7\xe9\xe8\xea\xeb\xed\xec\xee\xef\xf1\xf3\xf2\xf4\xf6\xf5\xfa\xf9\xfb\xfc\xb0\xa7\xb6\xdf\xae\xb4\xa8\xc6\xd8\xa5\xaa\xba\xe6\xf8\xbf\xa1\xac\xab\xbb\xa0\xc0\xc3\xf7\xff\xa4\xb7\xc2\xca\xc1\xcb\xc8\xcd\xce\xcf\xcc\xd3\xd4\xd2\xda\xdb\xd9\xaf\xb8\x22\x22\x27\x27-");
}

$fichier = mac_roman_to_iso(file_get_contents($fichier));
$xmlInput = simplexml_load_string(utf8_encode($fichier));

And after, encode the value from ISO-8859-1 to UTF-8 with iconv().

  • 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-05-24T20:29:25+00:00Added an answer on May 24, 2026 at 8:29 pm

    The problem is not with UTF-8. The problem is that your XML file is not UTF-8 encoded, it is MacRoman encoded. Treat it as a MacRoman-encoded file and it should work fine.

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

Sidebar

Related Questions

I need to parse a XML file which I get from third party to
Can I read a XML file from remote server such as http://dealer.somedomain.com/data/inventory.xml I need
I need to cache some xml from a webservice to a local xml file
I need to get the xml path opf the xml file by providing the
I am reading an XML file into a DataSet and need to get the
Need to get rid of jsessionid from my url. After some research on the
I need to print out the contents of an xml file into some txt
I'm trying to use JAXB to pull some elements from a large XML file
I need to replace all occurrence of some regular expression in xml file with
I am new to iPhone. I need to get images from a local XML

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.