h***@gmail.com
2014-04-19 08:57:51 UTC
I've modified tv_cat to accept files of different encodings. (bug #144)
Normal behaviour is still to barf when fed files with different encodings (i.e. status quo), but if you give the --utf8 option then it will combine the files (transcoding any which aren't already in utf-8 or *assumed* to be in utf-8 - if no encoding is specified in the xml then tv_cat will assume it's utf-8) and the output will be utf-8.
Only utf-8 output is allowed since it's not 'safe' to combine different encodings to anything else other than utf.
So you run it like this:
tv_cat --utf8 --output newfile.xml file1.xml file2.xml ...
I'd be grateful if someone could try and break it, please :-) And check I've not broken something else in the process.
It has required changes to catfiles() and parsefiles_callback() in xmltv.pm but hopefully hasn't affected the behaviour of anything else (i.e. no changes should be required to any other module which calls these methods).
As far as I can see, XMLTV::parsefiles_callback is only used in: tv_cat, tv_extractinfo_en, tv_split, tv_imdb. ( i.e. parsefiles() & catfiles() methods)
Note: I've not attempted to make this generic as it's really only for use by tv_cat (So for example I've not done parsefiles() ).
Thanks,
Geoff
Normal behaviour is still to barf when fed files with different encodings (i.e. status quo), but if you give the --utf8 option then it will combine the files (transcoding any which aren't already in utf-8 or *assumed* to be in utf-8 - if no encoding is specified in the xml then tv_cat will assume it's utf-8) and the output will be utf-8.
Only utf-8 output is allowed since it's not 'safe' to combine different encodings to anything else other than utf.
So you run it like this:
tv_cat --utf8 --output newfile.xml file1.xml file2.xml ...
I'd be grateful if someone could try and break it, please :-) And check I've not broken something else in the process.
It has required changes to catfiles() and parsefiles_callback() in xmltv.pm but hopefully hasn't affected the behaviour of anything else (i.e. no changes should be required to any other module which calls these methods).
As far as I can see, XMLTV::parsefiles_callback is only used in: tv_cat, tv_extractinfo_en, tv_split, tv_imdb. ( i.e. parsefiles() & catfiles() methods)
Note: I've not attempted to make this generic as it's really only for use by tv_cat (So for example I've not done parsefiles() ).
Thanks,
Geoff