Subject: | Encoding problem with XML::Atom |
Date: | Sat, 26 Aug 2006 14:40:33 +0100 |
To: | bug-XML-Atom [...] rt.cpan.org |
From: | Rui Vilela <ruivilela [...] di.uminho.pt> |
Hello,
I'm using XML::Atom 0.22 and when using method as_xml I obtain a XML
file with declared utf-8, but the characters have been converted to
iso-8859-1.
I have attached the xml result and a small perl file which i used to
simulate the problem.
Details of operating systems:
Linux Daphnis 2.6.17-gentoo-r4 #1 PREEMPT Tue Jul 25 16:46:24 WEST 2006
i686 Intel(R) Pentium(R) 4 CPU 2.40GHz GNU/Linux
LANG=pt_PT.UTF-8
perl 5.8.8
Linux natura 2.6.9-1.715_FC3 #1 Mon Dec 13 00:10:27 EST 2004 i686 i686
i386 GNU/Linux
LANG=en_US.UTF-8
perl 5.8.5
there aren't warning messages or errors.
Regards
Rui Vilela
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title xmlns="http://www.w3.org/2005/Atom">Dicionários Opensource para o português</title>
<link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="http://natura.di.uminho.pt/natura/natura?&topic=Dicion%E1rios"/>
<entry xmlns="http://www.w3.org/2005/Atom">
<title xmlns="http://www.w3.org/2005/Atom">Nova versão do dicionário português:</title>
<content xmlns="http://www.w3.org/2005/Atom" type="html"></br>
<p>Alterações efectuadas desde a última actualização (Há _days dia):</p>================================================================<br>
</br>
<pre>Ver CHANGELOG para mais informações</pre>
</content>
</entry>
</feed>
#!/usr/bin/perl
use strict;
use warnings;
use XML::Atom::Feed;
use XML::Atom::Entry;
use Data::Dumper;
my $feedfile='Atom.xml';
$XML::Atom::DefaultVersion = "1.0";
my $feed = XML::Atom::Feed->new(Version => 1.0);
$feed->version; # 1.0
$feed->title("Dicionários Opensource para o português");
my $mlink = XML::Atom::Link->new;
$mlink->type('text/html');
$mlink->rel('alternate');
$mlink->href('http://natura.di.uminho.pt/natura/natura?&topic=Dicion%E1rios');
$feed->add_link($mlink);
#######################################################
my $entry = XML::Atom::Entry->new(Version => 1.0);;
$entry->title('Nova versão do dicionário português:');
my $rcvs="<p>Alterações efectuadas desde a última actualização (Há _days dia):</p>";
$rcvs.='='x64;
$rcvs.="<br>\n\n";
#GET LAST ENTRYS
$entry->content("</br>\n$rcvs</br>\n<pre>Ver CHANGELOG para mais informações</pre>\n");
$feed->add_entry($entry);
#######################################################
my $xml = $feed->as_xml;
#print Dumper \$xml;
open my $F, ">$feedfile" or warn "Não foi possÃvel criar o ficheiro $feedfile - $!";
print $F $xml;
close $F;
Message body is not shown because sender requested not to inline it.