in reply to Re: XML::Twig and HTML Entities
in thread XML::Twig and HTML Entities

Here's what the code snippet actually generates:
<?xml version="1.0" encoding="utf-8"?> <log>&amp;lt;pre&gt;won't escape properly - uggh!&amp;lt;/pre&gt;</log +>
Here's what I desire?
<?xml version="1.0" encoding="utf-8"?> <log>&lt;pre&gt;won't escape properly - uggh!&lt;/pre&gt;</log>
Notice that it does an encode_entities() on the '&' in both of the '&lt;' series. I either want XML::Twig to encode everything or nothing but not a partial encode.

Replies are listed 'Best First'.
Re^3: XML::Twig and HTML Entities
by Anonymous Monk on Nov 12, 2004 at 20:19 UTC
    Why not? Without an opening '<' a '>' is a normal char and doesn't need to encode().
      Update:

      It turns out in the code excerpt I wrote to demonstrate my problem, the problem is easily solved by setting 'keep_encoding => 1' when the Twig is created.

      In the actual code that is trying to do this same thing, 'keep_encoding => 1' is set but the output behaves like it is not set. And I get the behavior described in the original message. Maybe this additional information will ring a bell with someone.

        It's hard to help when the code you post doesn't reflect the actual problem you're experiencing. If you can, post an example that behaves improperly with the undesired output as well as the desired output.