cmd/go: detect UTF-16 encoded sources and improve error reporting #71872
Labels
FeatureRequest
Issues asking for a new feature that does not need a proposal.
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
ToolProposal
Issues describing a requested change to a Go tool or command-line program.
Milestone
Go version
go version go1.24.0 windows/amd64
Output of
go env
in your module/workspace:set GOOS=windows
What did you do?
A text file created with the
echo
command in PowerShell on Windows 11 is encoded in UTF-16.What did you see happen?
What did you expect to see?
The Go parser should detect that the NUL byte in the file is due to the file being encoded as UTF-16 (the NUL byte detection should trigger a check of the BOM) and report a specific message about an encoding issue.
This is an usability issue because some popular text editors such as Visual Studio Code do not (yet) signal the incorrect encoding.
The text was updated successfully, but these errors were encountered: