>From 01ee0e8ecf40115fdb8bfad1b237449cfc2160df Mon Sep 17 00:00:00 2001 From: Dave Lambley Date: Fri, 22 Mar 2013 19:58:20 +0000 Subject: [PATCH] Use XML safe numeric entities. --- get_iplayer | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/get_iplayer b/get_iplayer index ff8b480..f210317 100755 --- a/get_iplayer +++ b/get_iplayer @@ -56,7 +56,7 @@ use File::Path; use File::stat; use File::Spec; use Getopt::Long; -use HTML::Entities; +use HTML::Entities qw/ encode_entities_numeric /; use HTTP::Cookies; use HTTP::Headers; use IO::Seekable; @@ -2231,15 +2231,15 @@ sub create_xml { $program_count{ $this->{name} }++; } for my $name ( sort keys %program_index ) { - print XML "\t\t\n" if $opt->{fxd}; + print XML "\t\t\n" if $opt->{fxd}; print XML "\t\n" if $opt->{mythtv}; - print XML "\t\t".encode_entities( $name )."\n" if $opt->{mythtv}; + print XML "\t\t".encode_entities_numeric( $name )."\n" if $opt->{mythtv}; for my $this (@_) { my $pid = $this->{pid}; # loop through and find matches for each progname if ( $this->{name} eq $name ) { - my $episode = encode_entities( $this->{episode} ); - my $desc = encode_entities( $this->{desc} ); + my $episode = encode_entities_numeric( $this->{episode} ); + my $desc = encode_entities_numeric( $this->{desc} ); my $title = "${episode}"; $title .= " ($this->{available})" if $this->{available} !~ /^(unknown|)$/i; if ( $opt->{fxd} ) { @@ -2284,10 +2284,10 @@ sub create_xml { push @{ $channels{ $this->{channel} } }, $this->{name}; } for my $channel ( sort keys %channels ) { - print XML "\t\t\n" if $opt->{fxd}; + print XML "\t\t\n" if $opt->{fxd}; print XML "\t\n". - "\t\t".encode_entities( $channel )."\n". + "\t\t".encode_entities_numeric( $channel )."\n". "\t\tBBC\n". "\t\t\n" if $opt->{mythtv}; for my $name ( sort keys %program_index ) { @@ -2297,14 +2297,14 @@ sub create_xml { $match = 1 if $_ eq $name; } if ( $match ) { - print XML "\t\t\t\n" if $opt->{fxd}; + print XML "\t\t\t\n" if $opt->{fxd}; #print XML "\t\t\n" if $opt->{mythtv}; for my $this (@_) { # loop through and find matches for each progname for this channel my $pid = $this->{pid}; if ( $this->{channel} eq $channel && $this->{name} eq $name ) { - my $episode = encode_entities( $this->{episode} ); - my $desc = encode_entities( $this->{desc} ); + my $episode = encode_entities_numeric( $this->{episode} ); + my $desc = encode_entities_numeric( $this->{desc} ); my $title = "${episode} ($this->{available})"; if ( $opt->{fxd} ) { print XML @@ -2319,7 +2319,7 @@ sub create_xml { } elsif ( $opt->{mythtv} ) { print XML "\t\t\t\n". - "\t\t\t\t".encode_entities( $name )."\n". + "\t\t\t\t".encode_entities_numeric( $name )."\n". "\t\t\t\t$this->{index}\n". "\t\t\t\t$this->{type}\n". "\t\t\t\t${pid}.mov\n". @@ -2359,9 +2359,9 @@ sub create_xml { print XML "\t\t\n"; for my $this (@_) { my $pid = $this->{pid}; - my $name = encode_entities( $this->{name} ); - my $episode = encode_entities( $this->{episode} ); - my $desc = encode_entities( $this->{desc} ); + my $name = encode_entities_numeric( $this->{name} ); + my $episode = encode_entities_numeric( $this->{episode} ); + my $desc = encode_entities_numeric( $this->{desc} ); my $title = "${name} - ${episode} ($this->{available})"; my $regex = $table{$folder}; if ( $name =~ /^$regex/i ) { @@ -4538,7 +4538,7 @@ sub substitute { $replace = StringUtils::sanitize_path( $value ); # html entity encode } elsif ($sanitize_mode == 3) { - $replace = encode_entities( $value ); + $replace = encode_entities_numeric( $value ); # escape these chars: ! ` \ " } elsif ($sanitize_mode == 4) { $replace = $value; -- 1.7.9.5