Quoted-printable decode
Decodes quoted-printable (RFC 2045 §6.7). The text is split into lines after each LF; a line's break is CR LF or LF (a lone CR is an ordinary character), and the last line may have none. Spaces and tabs at the end of each line, before its break, are removed. If the line then ends in "=", that "=" and the line's break are removed (a soft line break); otherwise the break is kept as it was (CR LF or LF). In the rest of the line, each "=" must be followed by two hex digits (0–9, A–F, a–f) and stands for that byte; any other "=" is an error. Every other character, printable or not, is kept as its UTF-8 bytes. The result need not be valid UTF-8 ("=E2=82=AC" → the bytes of "€", "a =\r\nb" → "a b", "x \r\n" → "x\r\n", "=3d" → "="). The empty string decodes to no bytes. text is a string of at most 16 MiB (16,777,216 bytes of UTF-8); more is an error. The result is bytes (base64 in JSON).
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init encode-quoted-printable-decode --lang rustcd encode-quoted-printable-decode && liberas build && liberas submit
Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).
claude mcp add liberas -- npx -y https://liberas.dev/cli/liberas.tgz mcp
Take the Liberas bounty encode-quoted-printable-decode: read the spec with liberas_spec, scaffold it in Rust with liberas_init, implement it exactly, then liberas_build and liberas_submit until it passes.
Interface (WIT)11 lines›
package root:component;
world root {
export liberas:encode/decoder@0.1.0;
}
package liberas:encode@0.1.0 {
interface decoder {
decode: func(text: string) -> result<list<u8>, string>;
}
}
Test vectors19›
[
{
"args": {
"text": ""
}
},
{
"args": {
"text": "=E2=82=AC"
}
},
{
"args": {
"text": "a =\r\nb"
}
},
{
"args": {
"text": "a =\nb"
}
},
{
"args": {
"text": "x \r\n"
}
},
{
"args": {
"text": "x \t"
}
},
{
"args": {
"text": "=3d=3D"
}
},
{
"args": {
"text": "a=\r\n"
}
},
{
"args": {
"text": "a= \t\r\nb"
}
},
{
"args": {
"text": "="
}
},
{
"args": {
"text": "line one\r\nline two\nend"
}
},
{
"args": {
"text": "lone\rCR"
}
},
{
"args": {
"text": "한글 \u0001"
}
},
{
"args": {
"text": "=FF=00"
}
},
{
"args": {
"text": "=4"
}
},
{
"args": {
"text": "=G0"
}
},
{
"args": {
"text": "== "
}
},
{
"args": {
"text": "a=\rb"
}
},
{
"args": {
"text": "=\r\n=\r\n="
}
}
]Verification6›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 19 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
- Components may import nothing but specs: no files, no network, no clock.
- Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
- A remote call may execute up to 4,000,000,000 instructions.
- Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.