Format of options file
RS
richard22j at zoho.com
Sun Mar 4 11:59:52 PST 2018
On 04/03/18 15:52, MacFH - C E Macfarlane wrote:
> Please see below ...
>
> On 04/03/2018 00:24, RS wrote:
>>
>> On 03/03/18 23:44, MacFH - C E Macfarlane wrote:
>>
>>> But as the OP is changing over to Linux, perhaps the de facto
>>> standard 'dos2unix' would be a more appropriate recommendation.
>>
>> Thanks for the suggestion but I don't think I need to convert the
>> download_history file (although gedit complained about invalid UTF-8
>> characters) and thanks to Ralph's command I now have an options file
>> which consistently uses 0x0D as a line terminator.
>
> You seem to be confused about which line terminators are used by each
> operating system, so to confirm:
> OS Mnem Hex code
> ---------------------------------
> Linux LF 0x0A
> Mac CR 0x0D (I believe)
> Win CRLF 0x0D0x0A
>
You're right I am a bit confused, but not about the line termination
conventions for each OS, although I can't speak for the Mac.
What I said the download_history file was wrong. I have now looked at
it with a hex editor which allows me to view the whole file. Most of it
was written in Windows and has CRLF as a line terminator. The most
recent records, appended to the end, written in Linux, have LF as a line
terminator. The important thing is that the discrepancy does not stop
it working. The entries are indexed by pid. The script is able to find
the pid whether it is preceded by LF or CRLF, and identify the programme
as already in history. The mixed file works both in Linux and in Windows.
In the case of the options file the discrepancy in line termination does
prevent some options from being interpreted correctly. To find out why
I need to compare the Perl code for parsing the download_history file
with that for parsing the options file. I have not yet managed to find it.
As for using win2unix to convert, if you look at the win2unix
documentation you will see it is not that simple. It is possible to use
it just to change the line terminations. You also need to think about
character sets. Some of the comments in the code say UTF-8 is used for
Linux and cp850 for Windows. If I remember from 30 odd years ago that
was the oldest MSDOS code page. Should that be converted too? If I
want to go backwards and forwards I don't want to keep converting.
Best wishes
Richard
More information about the get_iplayer
mailing list