Skip to content

@encoding

Import this module with import @encoding.

Function Signature Description
base64_encode (s string) -> string Encode to base64
base64_decode (s string) -> string Decode from base64
base64_url_encode (s string) -> string Encode to unpadded URL-safe base64 (-_, no =)
base64_url_decode (s string) -> string Decode URL-safe base64, with or without padding
hex_encode (s string) -> string Encode to hex
hex_decode (s string) -> string Decode from hex
url_encode (s string) -> string URL percent-encode
url_decode (s string) -> string URL percent-decode
html_escape (s string) -> string Escape & < > " ' as HTML entities
html_unescape (s string) -> string Resolve named and numeric HTML entities
shell_escape (s string) -> string Quote a string as one POSIX shell argument
Function Signature Description
from_string (s string) -> [u8] Create from UTF-8 string
from_hex (hex string) -> [u8] Decode hex string
from_base64 (b64 string) -> [u8] Decode base64 string
to_string (bytes [u8]) -> string Convert to UTF-8 string
to_hex (bytes [u8]) -> string Encode to hex string
to_base64 (bytes [u8]) -> string Encode to base64 string