Handle source files with a byte-order marker#5466
Open
lucymcphail wants to merge 1 commit intogleam-lang:mainfrom
Open
Handle source files with a byte-order marker#5466lucymcphail wants to merge 1 commit intogleam-lang:mainfrom
lucymcphail wants to merge 1 commit intogleam-lang:mainfrom
Conversation
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
ankddev
reviewed
Mar 17, 2026
|
|
||
| ## Unreleased | ||
|
|
||
| - The compiler now parses source files with a byte-order mark correctly, |
Contributor
There was a problem hiding this comment.
You should add entry under one of sections like bug fuxes, see in other changeligs
| @@ -0,0 +1,23 @@ | |||
| name: test | |||
Contributor
There was a problem hiding this comment.
Could you remove these unused files like workflows from test?
| @@ -0,0 +1,24 @@ | |||
| # bom | |||
Contributor
There was a problem hiding this comment.
Could you add a description of test and what it does in this README?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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