xmltv/grab/fi_sv tv_grab_fi_sv,1.14,1.15
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/fi_sv
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3069
Modified Files:
tv_grab_fi_sv
Log Message:
(minor) fix non-break space chars in description
Index: tv_grab_fi_sv
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/fi_sv/tv_grab_fi_sv,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** tv_grab_fi_sv 19 Apr 2014 11:17:19 -0000 1.14
--- tv_grab_fi_sv 28 May 2014 15:23:44 -0000 1.15
***************
*** 537,546 ****
- # Fix-ups
- # For reasons known only to itself, ValidateFile.pm rejects soft hyphens (\xc2\xad) claiming they are "control characters" !
- # I can't see why it thinks this but we have no choice but to delete them if we want to pass tv_ validation
- $p_desc =~ s/\xad//g;
-
-
# Create the data structure for the program.
my $program =
--- 537,540 ----
***************
*** 551,555 ****
};
$program->{'stop'} = $p_dtend if (defined $p_dtend && $p_dtend ne '');
! $program->{'desc'} = [[ encode('iso-8859-1', $p_desc), $LANGUAGE_CODE ]] if (defined $p_desc && $p_desc ne '');
$program->{'sub-title'} = [[ encode('iso-8859-1', $p_subtitle), $LANGUAGE_CODE ]] if (defined $p_subtitle && $p_subtitle ne '');
$program->{'category'} = [[ encode('iso-8859-1', $p_category) ]] if (defined $p_category && $p_category ne '');
--- 545,549 ----
};
$program->{'stop'} = $p_dtend if (defined $p_dtend && $p_dtend ne '');
! $program->{'desc'} = [[ encode('iso-8859-1', tidy( $p_desc) ), $LANGUAGE_CODE ]] if (defined $p_desc && $p_desc ne '');
$program->{'sub-title'} = [[ encode('iso-8859-1', $p_subtitle), $LANGUAGE_CODE ]] if (defined $p_subtitle && $p_subtitle ne '');
$program->{'category'} = [[ encode('iso-8859-1', $p_category) ]] if (defined $p_category && $p_category ne '');
***************
*** 610,613 ****
--- 604,616 ----
}
+ # Remove bad chars from an element
+ sub tidy( $ ) {
+ return $_[0] if !defined $_[0];
+ $_[0] =~ s/(\s)\xA0/$1/og; # replace 'space- ' with 'space'
+ $_[0] =~ s/\xA0/ /og; # replace any remaining with space
+ $_[0] =~ s/\xAD//og; # delete soft hyphens
+ return $_[0];
+ }
+
# Trim function to remove whitespace from the start and end of the
# string.
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet