作者writeman (夕阳武士)
看板perl
标题[问题] XML::RSS乱码问题?
时间Wed Jun 27 12:02:36 2007
想用perl产生网站的RSS
试了一下XML::RSS模组
却发现产生出来的文字档有一堆乱码
程式码如下:
use XML::RSS;
my $rss=new XML::RSS(version => '2.0');
$rss->channel(
title=>'测试',
link=>'
http://www.google.com',
description=>'测试',
);
for($i=0; $i<=1; $i++){
$rss->add_item(
title=> '测试',
link=> '
http://www.google.com',
description=> '测试',
);
}
$rss->save('aa.xml');
输出结果如下:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:blogChannel="
http://backend.userland.com/blogChannelModule">
<channel>
<title>´ú¸Õ</title>
<link>
http://www.google.com</link>
<description>´ú¸Õ</description>
<item>
<title>´ú¸Õ</title>
<link>
http://www.google.com</link>
<description>´ú¸Õ</description>
</item>
<item>
<title>´ú¸Õ</title>
<link>
http://www.google.com</link>
<description>´ú¸Õ</description>
</item>
</channel>
</rss>
请教网友这是哪里没设定对吗?
我的执行环境是 WIN2000 里跑 ActivePerl 5.8.8
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 163.29.197.254