Could you give something that reproduces the problem? I wasn't able to.

$ cat a.pl use XML::Twig; my $gPFile = 'test.xml'; open (TMP,">".$gPFile.".pp") or die;; my $ppml_twig = new XML::Twig(keep_encoding => 1); $ppml_twig->parsefile($gPFile); $ppml_twig->set_pretty_print('indented'); $ppml_twig->print( \*TMP);; close(TMP); $ perl -pe'use open ":std", ":locale"; BEGIN { binmode STDIN, ":raw:en +coding(Windows-1252)" }' test.xml <?xml version="1.0" encoding="Windows-1252"?> <root> <element> <child>foo</child> <child>bar</child> <child>é</child> </element> </root> $ perl a.pl $ perl -pe'use open ":std", ":locale"; BEGIN { binmode STDIN, ":raw:en +coding(Windows-1252)" }' test.xml.pp <?xml version="1.0" encoding="Windows-1252"?> <root> <element> <child>foo</child> <child>bar</child> <child>é</child> </element> </root>

In reply to Re: encoding failure with XML::Twig by ikegami
in thread encoding failure with XML::Twig by chastevens

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.