encoding

package
v0.0.0-...-c436d6b Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(name string) (string, error)

Decode returns a decoded string that was encoded using Encode.

If the provided string is not a valid encoding (for example it ends with a backslash) then an error will be returned.

func Encode

func Encode(name string) string

Encode returns a string that uses Go escape sequences for non-ASCII and non-printable characters as defined by IsPrint. In addition some other characters such as backslashes (\) and double quotes (") will also be escaped using Go escape sequence.

The rational here is that given Nixplay does not document any sort of API we really don't have any guarantee what sort of characters it supports now or in the future. I did some experimentation and things seem to mostly work except for some non-ASCII characters like emoji. So in an effort to make sure we can continue to support any sort of weird names that we can come up with we will be pretty aggressive with the encoding and encode any non-ASCII or non-printable characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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