Skip to content

Standardise source encoding and line endings #665

Closed
@rjmholt

Description

@rjmholt

The source code for PSES seems to have inconsistent BOM usage and line endings. It's not a huge issue, but making a change recently caused VSCode to redo some line endings and generated a large number of false changes, which mainly just makes git diffs impossible to review.

We should pick a standard of BOM usage (as in, UTF-8 with BOM or UTF-8 without BOM) and of line endings (\n vs \r\n). Ideally, a pragmatic choice will be one that works cross platform and which editors and tools are least likely to change back/interfere with.

There are a couple of points of information worth noting here:

  • git can handle line-ending conversion nicely, but is usually only configured to do so on Windows.
  • VSCode allows "files.encoding" to take "utf8" and "utf8bom" as values, and I'm assuming it honours the encoding.
  • VSCode also has a "files.eol" setting which can be set to "\n" or "\r\n", but apparently it ignores this setting if it finds a CRLF in the file and just reverts to CRLF.

I'm not sure how good other editors are at handling encoding issues like this; to fix the problem I had, I ended up needing to use vim to prevent VSCode from automatically changing line endings. I'm hoping that Atom and SublimeText will also honour encoding settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions