Skip to content

Handle source files with a byte-order marker#5466

Open
lucymcphail wants to merge 1 commit intogleam-lang:mainfrom
lucymcphail:lucy-handle-bom
Open

Handle source files with a byte-order marker#5466
lucymcphail wants to merge 1 commit intogleam-lang:mainfrom
lucymcphail:lucy-handle-bom

Conversation

@lucymcphail
Copy link

The Unicode specification allows UTF-8 files to begin with a byte-order marker (BOM), U+FEFF. In UTF-8 specifically, the BOM contains no information, since byte order is already unambiguous. However, some programs, especially on Windows, treat the BOM as a magic number to identify UTF-8 files, and even insert a BOM when creating or saving files. As such, we should be able to parse source files with a BOM so as not to worsen the experience for some Windows users.

Implements #5391

  • The changes in this PR have been discussed beforehand in an issue
  • The issue for this PR has been linked
  • Tests have been added for new behaviour
  • The changelog has been updated for any user-facing changes

The Unicode specification allows UTF-8 files to begin with a byte-order
marker (BOM), U+FEFF. In UTF-8 specifically, the BOM contains no
information, since byte order is already unambiguous. However, some
programs, especially on Windows, treat the BOM as a magic number to
identify UTF-8 files, and even insert a BOM when creating or saving
files. As such, we should be able to parse source files with a BOM so as
not to worsen the experience for some Windows users.

Implements gleam-lang#5391
Copy link
Contributor

@ankddev ankddev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some notes from me


## Unreleased

- The compiler now parses source files with a byte-order mark correctly,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add entry under one of sections like bug fuxes, see in other changeligs

@@ -0,0 +1,23 @@
name: test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove these unused files like workflows from test?

@@ -0,0 +1,24 @@
# bom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a description of test and what it does in this README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants