@std/encoding.ms#
Import each required symbol with import Name from "@std/encoding.ms".
EncodingError Alternative#
Errors returned when encoded text is invalid or exceeds a supplied byte limit.
Manuscript
type EncodingError:
case InvalidInput
case InvalidData
case LimitExceededManuscript
impl Error for EncodingError:
fn message() -> String:EncodingError.InvalidData#
Hexadecimal digits or strict padded Base64 syntax/characters are invalid.
Manuscript
case InvalidDataEncodingError.InvalidInput#
A supplied decoded-output byte budget is negative.
Manuscript
case InvalidInputEncodingError.LimitExceeded#
The decoded byte count exceeds the supplied output budget.
Manuscript
case LimitExceededEncodingError.Error.message#
Returns an encoding-prefixed diagnostic without echoing the encoded input.
Manuscript
fn message() -> String:base64_decode Function#
Decodes standard Base64 by default; set url_safe: true for the URL-safe alphabet.
Manuscript
fn base64_decode(text: String, url_safe: Bool = false, max_bytes: Optional[Int] = none) -> Result[Bytes, EncodingError]:base64_encode Function#
Encodes bytes as standard Base64 by default; set url_safe: true for URL-safe text.
Manuscript
fn base64_encode(data: Bytes, url_safe: Bool = false) -> String:hex_decode Function#
Decodes hexadecimal text. max_bytes bounds decoded output when supplied.
Manuscript
fn hex_decode(text: String, max_bytes: Optional[Int] = none) -> Result[Bytes, EncodingError]:hex_encode Function#
Encodes each byte as two lowercase hexadecimal digits.
Manuscript
fn hex_encode(data: Bytes) -> String: