Format of options file

Ralph Corderoy ralph at inputplus.co.uk
Mon Mar 5 06:19:13 PST 2018


Hi Richard,

> I suggested ignoring CR because they are there.  Ideally they would
> not be there.  The files are internal to get_iplayer so they can be in
> any format.

Only if you don't want them to be native text files, editable on that
system with a text editor by any user.  And I thought you do because you
have been editing them.

> I would have thought it sensible to use LF as a line terminator for
> get_iplayer's internal files across all operating systems.  The
> question is how the CR are getting into the files in Windows.

I pre-empted this in the email you're replying to.

    Because C has lines terminated by LF, like Unix, C libraries on
    Windows convert CRLF to LF on reading a text file, and do the
    reverse on writing.  Perl implements that.

> If Perl can then handle the variants portably with chomp VARIABLE
> that's fine, but it doesn't seem to be working properly at the moment. 

That's not what chomp() does.  It removes a single trailing LF if it's
present.  The conversion of CRLF to LF on reading a text file is
PerlIO(3perl)'s `:crlf' layer, stacked on Windows systems.

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



More information about the get_iplayer mailing list