http://www.perlmonks.org?node_id=993447

MorayJ has asked for the wisdom of the Perl Monks concerning the following question:

Hello

I'm having trouble with something that I can't google easily, because I'm not sure what is happening.

I am using a loop to read an xml file into a variable. But each line is having some, and not all, html entities converted into their symbols. These are inside attributes which means the file is no longer digestible by the the prog I need to import it back into. Not well-formed, maybe.

<NODE id="431" text="&lt;P align=&amp;quot;left&amp;quot;&gt;Non-mortgage&amp;amp;nbsp;debts is yes&lt;/P&gt;" type="DataInput" contextstring="OtherPriorityDebts" groupnext="True" branchValue="Yes" dataDefaultV="Yes" dataVisible="False">

...gets converted to ...

<NODE id="431" text="<P align=&quot;left&quot;>Non-mortgage&amp;nbsp;debts is yes</P>" type="DataInput" contextstring="OtherPriorityDebts" groupnext="True" branchValue="Yes" dataDefaultV="Yes" dataVisible="False">

So, within the text attribute the &lt; and &gt; has converted to < or >. (and if I don't put <code> around that, the lt or gt converts here as well, so this seems to be standard.)

This is presumably to do with encoding, but I don't really know how to explore it and to make it not happen.

Could anyone advise?

Thanks for any help.

MorayJ