[chirp_devel] Files with CRLF vs. LF vs. CR?

Tom Hayward
Sat Nov 8 14:15:01 PST 2014


On Sat, Nov 8, 2014 at 1:13 PM, Tyler Tidman <tyler.tidman at draak.ca> wrote:
> I finally had some quiet time this weekend and was attempting to work on
> issue #1995 when I realized that I don't really know what the coding
> policy is regarding line terminators.
>
> However, I noticed that most of the files under stock_configs seem to
> have CRLF line terminators while some of them have LF line terminators.
>  Which one is preferred?  I would prefer LF as this is what all the
> Python source files seem to use.

The stock_configs are CSV files, not Python source files. They have
different requirements.

When Chirp reads CSV files, \n, \r, or \r\n are translated to \n. On
write, \n is translated to the system default line separator,
os.linesep. (This is built-in behavior for Python's CSV module, not
something we're doing explicitly.)

> As I am about to reorder pretty much all 61 lines of the file
> stock_configs/Marine\ VHF\ Channels.csv, I figured I might as well ask
> here first before finishing up the patch.  I feel that fixing the line
> terminators here for just this one file is probably acceptable in this
> instance.

Open the CSV in Chirp, edit something, and save it. That'll tell you
which line endings are appropriate for your system.

> Once I know for sure, I shall be raising another
> bug/ticket/issue/whatever to give all the rest of the stock_configs
> files the same line terminators.

There's no need to change something that isn't broken. You'll have to
convince us that there is some benefit to this change.

People use Chirp CSV files in a lot of different editors. Chirp,
Notepad, Excel, LibreOffice, etc., all work fine now. That's a long
list of tests that would need to be done to accept a change.

Tom KD7LXL



More information about the chirp_devel mailing list