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

luautf8

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package luautf8 is Lua's UTF-8, which differs from Go's: it encodes and, lax, decodes values up to 2^31-1 in up to six bytes, as the original UTF-8 did, for \u{...} escapes and the utf8 library.

Index

Constants

View Source
const (
	MaxUnicode = 0x10FFFF   // the largest code point, strictly
	MaxUTF     = 0x7FFFFFFF // the largest value Lua encodes
)

Variables

This section is empty.

Functions

func Decode

func Decode(s string, strict bool) (code uint32, size int, ok bool)

Decode decodes the sequence at the start of s, as lutf8lib.c's utf8_decode, returning its value and length, or ok false if it is invalid: overlong, too large, cut short, or, if strict, a surrogate or past MaxUnicode.

func Encode

func Encode(x uint32) []byte

Encode returns x, at most MaxUTF, in UTF-8, as lobject.c's luaO_utf8esc.

func IsContinuation

func IsContinuation(c byte) bool

IsContinuation reports whether c continues a UTF-8 sequence.

Types

This section is empty.

Jump to

Keyboard shortcuts

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