mapgen

package
v0.0.0-...-282c629 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package util provides convenient methods to fetch and parse table of confusable characters from unicode.org.

See https://util.unicode.org/UnicodeJsps/confusables.jsp for examples.

Index

Constants

View Source
const (
	UnicodeSecFiles   = "https://www.unicode.org/Public/security/" // Base URL of conusable files
	UnicodeMapVersion = "latest"                                   // Default version (latest dir point to most current version)
	UnicodeMapName    = "confusables.txt"                          // Target file with table of confusable chars
)

Constants used in generating URL to fetch confusable chars table

Variables

This section is empty.

Functions

func BuildUrl

func BuildUrl(version string) (s string, err error)

Returns URL for confusion table based on given version. Accepted values for version are "latest" or in "MAJOR.MINOR.PATCH" format.

func FetchMap

func FetchMap(version string) (m []byte, url string, err error)

Returns the requested confusable file from unicode.org. version can be "latest" or a valid semvar version (see BuildUrl).

Errors may be returned if

  • wrong version is provided
  • HTTP queries to unicode.org fail
  • HTTP body cannot be read

func ParseMap

func ParseMap(mBytes []byte) (res map[rune][]byte, err error)

For formating specifications see https://www.unicode.org/reports/tr39/#:~:text=Data%20File%20Format

Types

This section is empty.

Jump to

Keyboard shortcuts

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