Help us shape the future of Go! Take the 2026 Go Developer Survey

textenc

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package textenc turns the text of an import source into plain UTF-8. Windows tools write a byte order mark, and PowerShell's > and Notepad's "Unicode" save write UTF-16, so a file that looks fine to its owner is not valid JSON or YAML to a parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToUTF8

func ToUTF8(data []byte) []byte

ToUTF8 drops a UTF-8 byte order mark and converts UTF-16 (marked by its byte order mark) to UTF-8. Anything else is returned unchanged. A trailing odd byte of UTF-16 text is dropped.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL