Skip to content

Commit 06e9b2c

Browse files
perilloVexu
authored andcommitted
langref: document UTF-8 BOM handling
The current compiler ignores the UTF-8 BOM if it is at the start of the file, and disallows it anywhere else. Document it in the Source Encoding section.
1 parent 7b68b76 commit 06e9b2c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/langref.html.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11480,6 +11480,10 @@ fn readU32Be() u32 {}
1148011480
but use of hard tabs is discouraged. See {#link|Grammar#}.
1148111481
</p>
1148211482
<p>
11483+
For compatibility with other tools, the compiler ignores a UTF-8-encoded byte order mark (U+FEFF)
11484+
if it is the first Unicode code point in the source text. A byte order mark is not allowed anywhere else in the source.
11485+
</p>
11486+
<p>
1148311487
Note that running <kbd>zig fmt</kbd> on a source file will implement all recommendations mentioned here.
1148411488
Note also that the stage1 compiler does <a href="https://github.com/ziglang/zig/wiki/FAQ#why-does-zig-force-me-to-use-spaces-instead-of-tabs">not yet support CR or HT</a> control characters.
1148511489
</p>

0 commit comments

Comments
 (0)