text

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package text is the adapter for core/port/text: golang.org/x/net/idna for domains, and golang.org/x/text/unicode/norm for the Unicode normal form. Both libraries are confined here (ADR-0056).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domains

type Domains struct{}

Domains encodes domain names with the lookup profile: the one for a name that is going to be resolved, which maps case, checks the labels and refuses what the DNS would.

func (Domains) ToASCII

func (Domains) ToASCII(domain string) (string, error)

ToASCII is the port's method.

type Forms

type Forms struct{}

Forms brings text to normal form C (i18n-l10n.md §5). NFC rather than NFKC: compatibility decomposition would rewrite what a person typed - `fi` into `fi`, `²` into `2`, full-width letters into ASCII - and a title is content, not an identifier. Canonical composition changes only the encoding of a character, never which character it is.

func (Forms) NFC

func (Forms) NFC(text string) string

NFC is the port's method. norm.NFC.String answers the input unchanged, without allocating, when it is already in normal form - which is nearly always.

func (Forms) NFKC

func (Forms) NFKC(text string) string

NFKC is the compatibility form, for the one secret this product normalises: a password (ADR-0068 §7). The fold that would destroy a title - `fi` into `fi`, a full-width letter into ASCII - is what makes the same word typed on two keyboards one password.

Jump to

Keyboard shortcuts

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