idna

Imports

Imports #

"fmt"
"strings"
"unicode/utf8"
"golang.org/x/text/secure/bidirule"
"golang.org/x/text/unicode/bidi"
"golang.org/x/text/unicode/norm"
"math"
"strings"
"unicode/utf8"
"fmt"
"strings"
"unicode/utf8"
"golang.org/x/text/secure/bidirule"
"golang.org/x/text/unicode/norm"

Constants & Variables

Display var #

Display is the recommended profile for displaying domain names. The configuration of this profile may change over time.

var Display *Profile = display

Display var #

Display is the recommended profile for displaying domain names. The configuration of this profile may change over time.

var Display *Profile = display

Lookup var #

Lookup is the recommended profile for looking up domain names, according to Section 5 of RFC 5891. The exact configuration of this profile may change over time.

var Lookup *Profile = lookup

Lookup var #

Lookup is the recommended profile for looking up domain names, according to Section 5 of RFC 5891. The exact configuration of this profile may change over time.

var Lookup *Profile = lookup

Punycode var #

Punycode is a Profile that does raw punycode processing with a minimum of validation.

var Punycode *Profile = punycode

Punycode var #

Punycode is a Profile that does raw punycode processing with a minimum of validation.

var Punycode *Profile = punycode

Registration var #

Registration is the recommended profile for checking whether a given IDN is valid for registration, according to Section 4 of RFC 5891.

var Registration *Profile = registration

Registration var #

Registration is the recommended profile for checking whether a given IDN is valid for registration, according to Section 4 of RFC 5891.

var Registration *Profile = registration

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "12.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "11.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "13.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "9.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "15.0.0"

UnicodeVersion const #

UnicodeVersion is the Unicode version from which the tables in this package are derived.

const UnicodeVersion = "10.0.0"

acePrefix const #

acePrefix is the ASCII Compatible Encoding prefix.

const acePrefix = "xn--"

acePrefix const #

acePrefix is the ASCII Compatible Encoding prefix.

const acePrefix = "xn--"

attributesMask const #

Attributes

const attributesMask = 0x1800

base const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const base int32 = 36

catBigMask const #

const catBigMask = 0xF8

catSmallMask const #

const catSmallMask = 0x3

damp const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const damp int32 = 700

deviation const #

const deviation category = 3

disallowed const #

const disallowed category = 0x40

disallowedSTD3Mapped const #

const disallowedSTD3Mapped category = 2

disallowedSTD3Valid const #

const disallowedSTD3Valid category = 0x80

display var #

var display = *ast.UnaryExpr

display var #

var display = *ast.UnaryExpr

idnaIndex var #

idnaIndex: 36 blocks, 2304 entries, 4608 bytes Block 0 is the zero block.

var idnaIndex = [2304]uint16{...}

idnaIndex var #

idnaIndex: 37 blocks, 2368 entries, 4736 bytes Block 0 is the zero block.

var idnaIndex = [2368]uint16{...}

idnaIndex var #

idnaIndex: 39 blocks, 2496 entries, 4992 bytes Block 0 is the zero block.

var idnaIndex = [2496]uint16{...}

idnaIndex var #

idnaIndex: 36 blocks, 2304 entries, 4608 bytes Block 0 is the zero block.

var idnaIndex = [2304]uint16{...}

idnaIndex var #

idnaIndex: 35 blocks, 2240 entries, 4480 bytes Block 0 is the zero block.

var idnaIndex = [2240]uint16{...}

idnaIndex var #

idnaIndex: 36 blocks, 2304 entries, 4608 bytes Block 0 is the zero block.

var idnaIndex = [2304]uint16{...}

idnaSparse var #

var idnaSparse = sparseBlocks{...}

idnaSparseOffset var #

idnaSparseOffset: 264 entries, 528 bytes

var idnaSparseOffset = []uint16{...}

idnaSparseOffset var #

idnaSparseOffset: 303 entries, 606 bytes

var idnaSparseOffset = []uint16{...}

idnaSparseOffset var #

idnaSparseOffset: 292 entries, 584 bytes

var idnaSparseOffset = []uint16{...}

idnaSparseOffset var #

idnaSparseOffset: 258 entries, 516 bytes

var idnaSparseOffset = []uint16{...}

idnaSparseOffset var #

idnaSparseOffset: 284 entries, 568 bytes

var idnaSparseOffset = []uint16{...}

idnaSparseOffset var #

idnaSparseOffset: 276 entries, 552 bytes

var idnaSparseOffset = []uint16{...}

idnaSparseValues var #

idnaSparseValues: 1997 entries, 7988 bytes

var idnaSparseValues = [1997]valueRange{...}

idnaSparseValues var #

idnaSparseValues: 2123 entries, 8492 bytes

var idnaSparseValues = [2123]valueRange{...}

idnaSparseValues var #

idnaSparseValues: 2180 entries, 8720 bytes

var idnaSparseValues = [2180]valueRange{...}

idnaSparseValues var #

idnaSparseValues: 2069 entries, 8276 bytes

var idnaSparseValues = [2069]valueRange{...}

idnaSparseValues var #

idnaSparseValues: 1869 entries, 7476 bytes

var idnaSparseValues = [1869]valueRange{...}

idnaSparseValues var #

idnaSparseValues: 1915 entries, 7660 bytes

var idnaSparseValues = [1915]valueRange{...}

idnaValues var #

idnaValues: 126 blocks, 8064 entries, 16128 bytes The third block is the zero block.

var idnaValues = [8064]uint16{...}

idnaValues var #

idnaValues: 128 blocks, 8192 entries, 16384 bytes The third block is the zero block.

var idnaValues = [8192]uint16{...}

idnaValues var #

idnaValues: 127 blocks, 8128 entries, 16256 bytes The third block is the zero block.

var idnaValues = [8128]uint16{...}

idnaValues var #

idnaValues: 135 blocks, 8640 entries, 17280 bytes The third block is the zero block.

var idnaValues = [8640]uint16{...}

idnaValues var #

idnaValues: 127 blocks, 8128 entries, 16256 bytes The third block is the zero block.

var idnaValues = [8128]uint16{...}

idnaValues var #

idnaValues: 127 blocks, 8128 entries, 16256 bytes The third block is the zero block.

var idnaValues = [8128]uint16{...}

ignored const #

const ignored category = 0xC0

indexShift const #

const indexShift = 3

initialBias const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const initialBias int32 = 72

initialN const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const initialN int32 = 128

inlineXOR const #

const inlineXOR = 0xE000

joinMask const #

const joinMask = 0x07

joinShift const #

const joinShift = 8

joinStates var #

var joinStates = [][numJoinTypes]joinState{...}

joinStates var #

var joinStates = [][numJoinTypes]joinState{...}

joinVirama const #

join types and additional rune information

const joinVirama

joinZWJ const #

the following types are derived during processing

const joinZWJ

joinZWNJ const #

join types and additional rune information

const joinZWNJ

joiningD const #

join types and additional rune information

const joiningD

joiningL const #

join types and additional rune information

const joiningL = *ast.ParenExpr

joiningR const #

join types and additional rune information

const joiningR

joiningT const #

join types and additional rune information

const joiningT

lookup var #

var lookup = *ast.UnaryExpr

lookup var #

var lookup = *ast.UnaryExpr

mapped const #

const mapped category = 1

mappingIndex var #

var mappingIndex = []uint16{...}

mappingIndex var #

var mappingIndex = []uint16{...}

mappings var #

var mappings string = *ast.BinaryExpr

mappings var #

var mappings string = *ast.BinaryExpr

mappings var #

var mappings string = *ast.BinaryExpr

mappings var #

var mappings string = *ast.BinaryExpr

mappings var #

var mappings string = *ast.BinaryExpr

mappings var #

var mappings string = *ast.BinaryExpr

mayNeedNorm const #

const mayNeedNorm = 0x2000

modifier const #

const modifier = 0x1000

numJoinTypes const #

join types and additional rune information

const numJoinTypes

punycode var #

var punycode = *ast.UnaryExpr

punycode var #

var punycode = *ast.UnaryExpr

registration var #

var registration = *ast.UnaryExpr

registration var #

var registration = *ast.UnaryExpr

rtl const #

const rtl = 0x0800

skew const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const skew int32 = 38

stateAfter const #

const stateAfter

stateAfter const #

const stateAfter

stateBefore const #

const stateBefore

stateBefore const #

const stateBefore

stateBeforeVirama const #

const stateBeforeVirama

stateBeforeVirama const #

const stateBeforeVirama

stateFAIL const #

const stateFAIL

stateFAIL const #

const stateFAIL

stateStart const #

const stateStart joinState = iota

stateStart const #

const stateStart joinState = iota

stateVirama const #

const stateVirama

stateVirama const #

const stateVirama

tmax const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const tmax int32 = 26

tmin const #

These parameter values are specified in section 5. All computation is done with int32s, so that overflow behavior is identical regardless of whether int is 32-bit or 64-bit.

const tmin int32 = 1

transitionalLookup const #

Transitional processing is disabled by default in Go 1.18. https://golang.org/issue/47510

const transitionalLookup = false

transitionalLookup const #

const transitionalLookup = true

trie var #

Don't use newIdnaTrie to avoid unconditional linking in of the table.

var trie = *ast.UnaryExpr

unknown const #

const unknown category = 0

valid const #

const valid category = 0x08

validNV8 const #

const validNV8 category = 0x18

validXV8 const #

const validXV8 category = 0x28

viramaModifier const #

const viramaModifier = 0x1800

xorBit const #

const xorBit = 0x4

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

xorData var #

var xorData string = *ast.BinaryExpr

zwj const #

const zwj = "\u200d"

zwj const #

const zwj = "\u200d"

zwnj const #

const zwnj = "\u200c"

zwnj const #

const zwnj = "\u200c"

Type Aliases

Option type #

An Option configures a Profile at creation time.

type Option func(*options)

Option type #

An Option configures a Profile at creation time.

type Option func(*options)

category type #

A category corresponds to a category defined in the IDNA mapping table.

type category uint16

info type #

info holds information from the IDNA mapping table for a single rune. It is the value returned by a trie lookup. In most cases, all information fits in a 16-bit value. For mappings, this value may contain an index into a slice with the mapped string. Such mappings can consist of the actual mapped value or an XOR pattern to be applied to the bytes of the UTF8 encoding of the input rune. This technique is used by the cases packages and reduces the table size significantly. The per-rune values have the following format: if mapped { if inlinedXOR { 15..13 inline XOR marker 12..11 unused 10..3 inline XOR mask } else { 15..3 index into xor or mapping table } } else { 15..14 unused 13 mayNeedNorm 12..11 attributes 10..8 joining type 7..3 category type } 2 use xor pattern 1..0 mapped category See the definitions below for a more detailed description of the various bits.

type info uint16

joinState type #

type joinState int8

joinState type #

type joinState int8

runeError type #

type runeError rune

runeError type #

type runeError rune

Structs

Profile struct #

A Profile defines the configuration of an IDNA mapper.

type Profile struct {
options
}

Profile struct #

A Profile defines the configuration of a IDNA mapper.

type Profile struct {
options
}

idnaTrie struct #

idnaTrie. Total size: 29052 bytes (28.37 KiB). Checksum: ef06e7ecc26f36dd.

type idnaTrie struct {

}

idnaTrie struct #

idnaTrie. Total size: 28600 bytes (27.93 KiB). Checksum: 95575047b5d8fff.

type idnaTrie struct {

}

idnaTrie struct #

idnaTrie. Total size: 29404 bytes (28.71 KiB). Checksum: 848c45acb5f7991c.

type idnaTrie struct {

}

idnaTrie struct #

idnaTrie. Total size: 29708 bytes (29.01 KiB). Checksum: c3ecc76d8fffa6e6.

type idnaTrie struct {

}

idnaTrie struct #

idnaTrie. Total size: 30196 bytes (29.49 KiB). Checksum: e2ae95a945f04016.

type idnaTrie struct {

}

idnaTrie struct #

idnaTrie. Total size: 31598 bytes (30.86 KiB). Checksum: d3118eda0d6b5360.

type idnaTrie struct {

}

labelError struct #

type labelError struct {
label string
code_ string
}

labelError struct #

type labelError struct {
label string
code_ string
}

labelIter struct #

A labelIter allows iterating over domain name labels.

type labelIter struct {
orig string
slice []string
curStart int
curEnd int
i int
}

labelIter struct #

A labelIter allows iterating over domain name labels.

type labelIter struct {
orig string
slice []string
curStart int
curEnd int
i int
}

options struct #

type options struct {
transitional bool
useSTD3Rules bool
checkHyphens bool
checkJoiners bool
verifyDNSLength bool
removeLeadingDots bool
trie *idnaTrie
fromPuny func(p *Profile, s string) error
mapping func(p *Profile, s string) (string, error)
bidirule func(s string) bool
}

options struct #

type options struct {
transitional bool
useSTD3Rules bool
checkHyphens bool
checkJoiners bool
verifyDNSLength bool
removeLeadingDots bool
trie *idnaTrie
fromPuny func(p *Profile, s string) error
mapping func(p *Profile, s string) (mapped string, isBidi bool, err error)
bidirule func(s string) bool
}

sparseBlocks struct #

type sparseBlocks struct {
values []valueRange
offset []uint16
}

valueRange struct #

type valueRange struct {
value uint16
lo byte
hi byte
}

Functions

BidiRule function #

BidiRule enables the Bidi rule as defined in RFC 5893. Any application that relies on proper validation of labels should include this rule. This option corresponds to the CheckBidi flag in UTS #46.

func BidiRule() Option

BidiRule function #

BidiRule enables the Bidi rule as defined in RFC 5893. Any application that relies on proper validation of labels should include this rule. This option corresponds to the CheckBidi flag in UTS #46.

func BidiRule() Option

CheckHyphens function #

CheckHyphens sets whether to check for correct use of hyphens ('-') in labels. Most web browsers do not have this option set, since labels such as "r3---sn-apo3qvuoxuxbt-j5pe" are in common use. This option corresponds to the CheckHyphens flag in UTS #46.

func CheckHyphens(enable bool) Option

CheckHyphens function #

CheckHyphens sets whether to check for correct use of hyphens ('-') in labels. Most web browsers do not have this option set, since labels such as "r3---sn-apo3qvuoxuxbt-j5pe" are in common use. This option corresponds to the CheckHyphens flag in UTS #46.

func CheckHyphens(enable bool) Option

CheckJoiners function #

CheckJoiners sets whether to check the ContextJ rules as defined in Appendix A of RFC 5892, concerning the use of joiner runes. This option corresponds to the CheckJoiners flag in UTS #46.

func CheckJoiners(enable bool) Option

CheckJoiners function #

CheckJoiners sets whether to check the ContextJ rules as defined in Appendix A of RFC 5892, concerning the use of joiner runes. This option corresponds to the CheckJoiners flag in UTS #46.

func CheckJoiners(enable bool) Option

Error method #

func (e labelError) Error() string

Error method #

func (e runeError) Error() string

Error method #

func (e labelError) Error() string

Error method #

func (e runeError) Error() string

MapForLookup function #

MapForLookup sets validation and mapping options such that a given IDN is transformed for domain name lookup according to the requirements set out in Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option to add this check. The mappings include normalization and mapping case, width and other compatibility mappings.

func MapForLookup() Option

MapForLookup function #

MapForLookup sets validation and mapping options such that a given IDN is transformed for domain name lookup according to the requirements set out in Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option to add this check. The mappings include normalization and mapping case, width and other compatibility mappings.

func MapForLookup() Option

New function #

New creates a new Profile. With no options, the returned Profile is the most permissive and equals the Punycode Profile. Options can be passed to further restrict the Profile. The MapForLookup and ValidateForRegistration options set a collection of options, for lookup and registration purposes respectively, which can be tailored by adding more fine-grained options, where later options override earlier options.

func New(o ...Option) *Profile

New function #

New creates a new Profile. With no options, the returned Profile is the most permissive and equals the Punycode Profile. Options can be passed to further restrict the Profile. The MapForLookup and ValidateForRegistration options set a collection of options, for lookup and registration purposes respectively, which can be tailored by adding more fine-grained options, where later options override earlier options.

func New(o ...Option) *Profile

RemoveLeadingDots function #

RemoveLeadingDots removes leading label separators. Leading runes that map to dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well.

func RemoveLeadingDots(remove bool) Option

RemoveLeadingDots function #

RemoveLeadingDots removes leading label separators. Leading runes that map to dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well.

func RemoveLeadingDots(remove bool) Option

StrictDomainName function #

StrictDomainName limits the set of permissible ASCII characters to those allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the hyphen). This is set by default for MapForLookup and ValidateForRegistration, but is only useful if ValidateLabels is set. This option is useful, for instance, for browsers that allow characters outside this range, for example a '_' (U+005F LOW LINE). See http://www.rfc-editor.org/std/std3.txt for more details. This option corresponds to the UseSTD3ASCIIRules flag in UTS #46.

func StrictDomainName(use bool) Option

StrictDomainName function #

StrictDomainName limits the set of permissible ASCII characters to those allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the hyphen). This is set by default for MapForLookup and ValidateForRegistration, but is only useful if ValidateLabels is set. This option is useful, for instance, for browsers that allow characters outside this range, for example a '_' (U+005F LOW LINE). See http://www.rfc-editor.org/std/std3.txt for more details. This option corresponds to the UseSTD3ASCIIRules flag in UTS #46.

func StrictDomainName(use bool) Option

String method #

String reports a string with a description of the profile for debugging purposes. The string format may change with different versions.

func (p *Profile) String() string

String method #

String reports a string with a description of the profile for debugging purposes. The string format may change with different versions.

func (p *Profile) String() string

ToASCII function #

ToASCII is a wrapper for Punycode.ToASCII.

func ToASCII(s string) (string, error)

ToASCII method #

ToASCII converts a domain or domain label to its ASCII form. For example, ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and ToASCII("golang") is "golang". If an error is encountered it will return an error and a (partially) processed result.

func (p *Profile) ToASCII(s string) (string, error)

ToASCII function #

ToASCII is a wrapper for Punycode.ToASCII.

func ToASCII(s string) (string, error)

ToASCII method #

ToASCII converts a domain or domain label to its ASCII form. For example, ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and ToASCII("golang") is "golang". If an error is encountered it will return an error and a (partially) processed result.

func (p *Profile) ToASCII(s string) (string, error)

ToUnicode function #

ToUnicode is a wrapper for Punycode.ToUnicode.

func ToUnicode(s string) (string, error)

ToUnicode method #

ToUnicode converts a domain or domain label to its Unicode form. For example, ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and ToUnicode("golang") is "golang". If an error is encountered it will return an error and a (partially) processed result.

func (p *Profile) ToUnicode(s string) (string, error)

ToUnicode function #

ToUnicode is a wrapper for Punycode.ToUnicode.

func ToUnicode(s string) (string, error)

ToUnicode method #

ToUnicode converts a domain or domain label to its Unicode form. For example, ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and ToUnicode("golang") is "golang". If an error is encountered it will return an error and a (partially) processed result.

func (p *Profile) ToUnicode(s string) (string, error)

Transitional function #

Transitional sets a Profile to use the Transitional mapping as defined in UTS #46. This will cause, for example, "ß" to be mapped to "ss". Using the transitional mapping provides a compromise between IDNA2003 and IDNA2008 compatibility. It is used by some browsers when resolving domain names. This option is only meaningful if combined with MapForLookup.

func Transitional(transitional bool) Option

Transitional function #

Transitional sets a Profile to use the Transitional mapping as defined in UTS #46. This will cause, for example, "ß" to be mapped to "ss". Using the transitional mapping provides a compromise between IDNA2003 and IDNA2008 compatibility. It is used by some browsers when resolving domain names. This option is only meaningful if combined with MapForLookup.

func Transitional(transitional bool) Option

ValidateForRegistration function #

ValidateForRegistration sets validation options to verify that a given IDN is properly formatted for registration as defined by Section 4 of RFC 5891.

func ValidateForRegistration() Option

ValidateForRegistration function #

ValidateForRegistration sets validation options to verify that a given IDN is properly formatted for registration as defined by Section 4 of RFC 5891.

func ValidateForRegistration() Option

ValidateLabels function #

ValidateLabels sets whether to check the mandatory label validation criteria as defined in Section 5.4 of RFC 5891. This includes testing for correct use of hyphens ('-'), normalization, validity of runes, and the context rules. In particular, ValidateLabels also sets the CheckHyphens and CheckJoiners flags in UTS #46.

func ValidateLabels(enable bool) Option

ValidateLabels function #

ValidateLabels sets whether to check the mandatory label validation criteria as defined in Section 5.4 of RFC 5891. This includes testing for correct use of hyphens ('-'), normalization, validity of runes, and the context rules. In particular, ValidateLabels also sets the CheckHyphens and CheckJoiners flags in UTS #46.

func ValidateLabels(enable bool) Option

VerifyDNSLength function #

VerifyDNSLength sets whether a Profile should fail if any of the IDN parts are longer than allowed by the RFC. This option corresponds to the VerifyDnsLength flag in UTS #46.

func VerifyDNSLength(verify bool) Option

VerifyDNSLength function #

VerifyDNSLength sets whether a Profile should fail if any of the IDN parts are longer than allowed by the RFC. This option corresponds to the VerifyDnsLength flag in UTS #46.

func VerifyDNSLength(verify bool) Option

adapt function #

adapt is the bias adaptation function specified in section 6.1.

func adapt(delta int32, numPoints int32, firstTime bool) int32

appendMapping method #

appendMapping appends the mapping for the respective rune. isMapped must be true. A mapping is a categorization of a rune as defined in UTS #46.

func (c info) appendMapping(b []byte, s string) []byte

appendMapping method #

appendMapping appends the mapping for the respective rune. isMapped must be true. A mapping is a categorization of a rune as defined in UTS #46.

func (c info) appendMapping(b []byte, s string) []byte

apply function #

func apply(o *options, opts []Option)

apply function #

func apply(o *options, opts []Option)

ascii function #

func ascii(s string) bool

ascii function #

func ascii(s string) bool

category method #

func (c info) category() category

code method #

func (e labelError) code() string

code method #

func (e runeError) code() string

code method #

func (e labelError) code() string

code method #

func (e runeError) code() string

decode function #

decode decodes a string as specified in section 6.2.

func decode(encoded string) (string, error)

decodeDigit function #

func decodeDigit(x byte) (digit int32, ok bool)

done method #

func (l *labelIter) done() bool

done method #

func (l *labelIter) done() bool

encode function #

encode encodes a string as specified in section 6.3 and prepends prefix to the result. The "while h < length(input)" line in the specification becomes "for remaining != 0" in the Go code, because len(s) in Go is in bytes, not runes.

func encode(prefix string, s string) (string, error)

encodeDigit function #

func encodeDigit(digit int32) byte

isBidi method #

func (c info) isBidi(s string) bool

isMapped method #

func (c info) isMapped() bool

isModifier method #

func (c info) isModifier() bool

isViramaModifier method #

func (c info) isViramaModifier() bool

joinType method #

func (c info) joinType() info

label method #

func (l *labelIter) label() string

label method #

func (l *labelIter) label() string

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookup(s []byte) (v uint16, sz int)

lookup method #

lookup determines the type of block n and looks up the value for b. For n < t.cutoff, the block is a simple lookup table. Otherwise, the block is a list of ranges with an accompanying value. Given a matching range r, the value for b is by r.value + (b - r.lo) * stride.

func (t *sparseBlocks) lookup(n uint32, b byte) uint16

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookupString(s string) (v uint16, sz int)

lookupString method #

lookupString returns the trie value for the first UTF-8 encoding in s and the width in bytes of this encoding. The size will be 0 if s does not hold enough bytes to complete the encoding. len(s) must be greater than 0.

func (t *idnaTrie) lookupString(s string) (v uint16, sz int)

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupStringUnsafe(s string) uint16

lookupStringUnsafe method #

lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupStringUnsafe(s string) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupUnsafe(s []byte) uint16

lookupUnsafe method #

lookupUnsafe returns the trie value for the first UTF-8 encoding in s. s must start with a full and valid UTF-8 encoded rune.

func (t *idnaTrie) lookupUnsafe(s []byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *idnaTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *idnaTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *idnaTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *idnaTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *idnaTrie) lookupValue(n uint32, b byte) uint16

lookupValue method #

lookupValue determines the type of block n and looks up the value for b.

func (t *idnaTrie) lookupValue(n uint32, b byte) uint16

madd function #

madd computes a + (b * c), detecting overflow.

func madd(a int32, b int32, c int32) (next int32, overflow bool)

newIdnaTrie function #

func newIdnaTrie(i int) *idnaTrie

newIdnaTrie function #

func newIdnaTrie(i int) *idnaTrie

newIdnaTrie function #

func newIdnaTrie(i int) *idnaTrie

newIdnaTrie function #

func newIdnaTrie(i int) *idnaTrie

newIdnaTrie function #

func newIdnaTrie(i int) *idnaTrie

newIdnaTrie function #

func newIdnaTrie(i int) *idnaTrie

next method #

next sets the value to the next label. It skips the last label if it is empty.

func (l *labelIter) next()

next method #

next sets the value to the next label. It skips the last label if it is empty.

func (l *labelIter) next()

normalize function #

func normalize(p *Profile, s string) (string, error)

normalize function #

func normalize(p *Profile, s string) (mapped string, isBidi bool, err error)

process method #

process implements the algorithm described in section 4 of UTS #46, see https://www.unicode.org/reports/tr46.

func (p *Profile) process(s string, toASCII bool) (string, error)

process method #

process implements the algorithm described in section 4 of UTS #46, see https://www.unicode.org/reports/tr46.

func (p *Profile) process(s string, toASCII bool) (string, error)

punyError function #

func punyError(s string) error

reset method #

func (l *labelIter) reset()

reset method #

func (l *labelIter) reset()

result method #

func (l *labelIter) result() string

result method #

func (l *labelIter) result() string

set method #

func (l *labelIter) set(s string)

set method #

func (l *labelIter) set(s string)

simplify method #

func (p *Profile) simplify(cat category) category

simplify method #

func (p *Profile) simplify(cat category) category

validateAndMap function #

func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error)

validateAndMap function #

func validateAndMap(p *Profile, s string) (string, error)

validateFromPunycode function #

func validateFromPunycode(p *Profile, s string) error

validateFromPunycode function #

func validateFromPunycode(p *Profile, s string) error

validateLabel method #

validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are already implicitly satisfied by the overall implementation.

func (p *Profile) validateLabel(s string) (err error)

validateLabel method #

validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are already implicitly satisfied by the overall implementation.

func (p *Profile) validateLabel(s string) error

validateRegistration function #

func validateRegistration(p *Profile, s string) (idem string, bidi bool, err error)

validateRegistration function #

func validateRegistration(p *Profile, s string) (string, error)

Generated with Arrow