Reference

std/uri/characters

std/uri/src/characters.trb

The character classes of RFC 3986 and the percent-encoding every other module of std/uri is written over.

Everything here reads bytes, not characters: every delimiter and every class the grammar has is ASCII, and a byte of 128 or more is part of a UTF-8 sequence, which a URI holds only percent-encoded (RFC 3987 section 3.1). So a scan is byteAt over the text, and a run of bytes that needs no change is copied with one sliceBytes.

fn percentDecoded

fn percentDecoded(text: String): Result<String, UriError>

Every percent escape of a text decoded, and the bytes read as UTF-8: a%20b is a b, %C3%A4 is รค. A % that starts no escape stays as it is.

Errors

  • UriError.NotText where the decoded bytes are not UTF-8, which %FF alone already is.