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

I have a Perl function that lets me alter the xml file that is created by another application.
Everything was OK but recently the first line of the xml file was changed to

<?xml version="1.0" encoding="UTF-8"?>

Now character  (A with a caret above it) - is no longer in front of the
degree sign after I have made modifications and the xml file can no longer be read with
Windows Explorer.

I start ‘reading’ the XML file with
$parser_res = 1; $parser = XML::DOM::Parser->new(KeepCDATA => 1);
Does any wiser Monk than I know how to cure this?
For example, is an additional argument required in the Parser statement.
The problem can be solved by opening and closing the file by the main application
but that is something I do not want to do.

Replies are listed 'Best First'.
Re: XML Encoding Problem
by idsfa (Vicar) on Nov 10, 2005 at 15:53 UTC

    You have not given us the information we need to help you. Where were/are the  and the ° you mention? How are you writing the file back out in perl?

    That said, is this your problem?


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon
      The  is just before the degree sign.
      I am writng the xml file with
      $xml_doc->printToFile($xml_file);
      .
      I will look at the reference you have given it may
      have the answer.
Re: XML Encoding Problem
by Aristotle (Chancellor) on Nov 10, 2005 at 20:14 UTC
Re: XML Encoding Problem
by grantm (Parson) on Nov 10, 2005 at 23:34 UTC
    The Perl XML FAQ has plenty to say about encodings.