unescape

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2026 YLD Limited SPDX-License-Identifier: Apache-2.0 Package unescape rewrites the Unicode escape sequences that hclwrite and gopkg.in/yaml.v3 emit for characters they wrongly treat as unprintable, restoring the raw UTF-8 without touching escapes the source itself contained.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unicode

func Unicode(src []byte) []byte

Unicode replaces \uXXXX and \UXXXXXXXX escape sequences with their raw UTF-8 equivalents for characters above U+009F. Both hclwrite and gopkg.in/yaml.v3 escape characters that are printable in their output format: hclwrite escapes any rune Go's unicode.IsPrint rejects, which includes category-Cf characters such as U+200D (ZWJ), and yaml.v3's is_printable helper only recognises 3-byte UTF-8, so supplementary-plane characters (emoji) are escaped too.

An escape the source itself contained is left alone. A writer emits a literal backslash doubled, so a run of backslashes of even length before "uXXXX" is text rather than an escape.

Types

This section is empty.

Jump to

Keyboard shortcuts

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