[mythtvnz] XMLTV headers changed

David Moore dmoo1790 at ihug.co.nz
Sat Jul 7 10:33:40 BST 2012


On 07/07/12 21:22, Stephen Worthington wrote:
> On Sat, 7 Jul 2012 19:25:53 +1200, you wrote:
>
>> Greetings
>>
>> It seems that the data contained in http://nzepg.org/freeview.xml.gz had a
>> change of header last weekend.
>>
>> I followed the conversation about mhegsnoop having a header change but
>> didn't realise it would propagate to the online data.
>>
>> This is a real problem for me as I merge data from epgsnoop with the
>> online stuff (which has more detail for FreeView) using 'tv_cat' from the
>> xmltv package and it barfs with:
>> "/tmp/listings-freeview-31681.xml: this file's encoding utf-8 differs from
>> others' ISO-8859-1 - aborting"
>>
>> So the online data now has utf-8 in the header but the epgsnoop data is
>> ISO-8859-1. I tried changing outputter.py (in epgsnoop) to utf-8 but the
>> data from satellite EPG has some interesting 8 bit characters (which I
>> assume really are ISO-8859-1 codes).
>>
>> So who is right - utf-8 or ISO-8859-1 and how can I merge the two
>> different encodings if they are both right!!
>>
>> Cheers
>
> UTF-8 is the default for xmltv files, so I think the best thing would
> be to find a way to convert the epgsnoop data to UTF-8.  I am sure
> Python can do it somehow.  iconv can do the raw encoding conversion,
> but does not understand xml and does not fix the headers.  So maybe a
> change to the epgsnoop code would be best, to get it to output in
> UTF-8.
>

It's dead easy to output xml as UTF-8 in Python:

ET.ElementTree(root_element).write(outfile, encoding="utf-8")

Writing the correct header is not so simple to do automagically but easy 
to write manually.



More information about the mythtvnz mailing list