Re: Segfault using HTML::Entities
[email protected] (Richard Jolly)
| Newsgroups | perl.unicode |
|---|---|
| Message-ID | <[email protected]> |
On 30 Jun 2004, at 17:52, Nicholas Clark wrote: > On Tue, Jun 29, 2004 at 06:49:16PM +0100, Richard Jolly wrote: >> #### Script > > Could you resend the script/data test case as an attachment please? Attached. > Nicholas Clark
old.pl
(application/octet-stream, 1.2 KB)
#!/usr/bin/perl
use strict;
use warnings;
use XML::RAI;
use HTML::Entities;
use Encode;
my $xml = do { local $/; <DATA> };
my $r = XML::RAI->parse( $xml );
foreach ( @{$r->items} ) {
my $t = $_->title;
print "$t\n";
$t = decode_entities($t);
$t = &HTML::Entities::encode_entities($t);
print "$t\n";
}
#<title>The Modern R&eacute;sum&eacute;</title>
__DATA__
<?xml version="1.0" ?>
<rss version="0.91">
<channel>
<title>Smartmoney.com - Consumer Action</title>
<link>http://www.smartmoney.com/consumer/?nav=RSS091</link>
<description>Investing, Saving and Personal Finance</description>
<language>en-us</language>
<copyright>Copyright 2004 Smartmoney.com, joint venture of Dow Jones & Co. and Hearst Communications, Inc.</copyright>
<item>
<title>The Modern R&eacute;sum&eacute;</title>
<link>http://www.smartmoney.com/consumer/index.cfm?story=20040505&nav=RSS091</link>
<description>R&eacute;sum&eacute;s that worked even a few years ago aren't effective today. Here are five essential updates.</description>
</item>
</channel>
</rss>