Jump to content

Recommended Posts

Hi,

 

I am pulling data from flat text files and converting them into XML files using DOM.  My problem seems to be with encoding.  A lot of the flat text files have trademark symbols, degree signs, sup characters etc.  When trying to add these to nodes in XML it seems to cause a problem.  I understand this is because XML doesn't like these characters.  I am trying to convert them using htmlentities() so that trademarks become ™ etc...  The problem is when it saves them to xml it looks like ™ - it seems when the file is saved it encodes it again.

 

I imagine this is a common issue but I could find no real help by googling it, maybe I am searching the wrong thing...

 

Any help is appreciated.

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/127541-solved-encoding-symbols-for-xml/
Share on other sites

I am pretty sure I figured it out.  When saving to xml I let the symbols get encoded to ™ or ° etc.  Then when I read the xml it auto decoded the &'s to be & and when echoing to the browser the symbols showed up correctly.

 

Kevin

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.