Golang: Source Code Encoding

By Xah Lee. Date: . Last updated: .

Golang file must be encoded in UTF-8.

This means, make sure to setup your text editor to save file as UTF-8. Find it in a menu or preference setting.

[see Unicode Basics: Character Set, Encoding, UTF-8]

VSCode, Set File Encoding

vscode encoding setting 2020-12-23 7X3f6
vscode encoding setting 2020-12-23

Vim, Set File Encoding

In vim, use one of these commands:

Emacs, Set File Encoding

Emacs File Encoding FAQ

Golang

Examples

Reference