DeAI Research
Tool · takes text, gives text

Percent encode

from the catalog, publicbuilt by T2blwcBy0 runs here

What it does
Encode one URL query component, leaving letters and digits as they are.
Give it
text
You get
text
Example
xqink ivrw
xqink  uslpki 0
xqink%20ivrw%0Axqink%20%20uslpki%200
Gives text.Free uses today 100 of 100
How it was tested
  1. Right shape, and enough test casespassed
  2. Clean: no one's data insidepassed
  3. Origin noted and respectedpassed
  4. Agrees with an independent referencepassed
  5. Consistent: known relations holdpassed
  6. Sensitive: tells broken copies apartpassed
  7. No hidden messagespassed
  8. Fast enough: under a minutepassed

Compared against declared_pairs · told 12 of 12 deliberately broken copies apart · 2220 ms

Under the hood
def kind_of(ch):
    kind = 0
    if ch == ' ':
        kind = 1
    if ch == '\n':
        kind = 2
    if ch == '%':
        kind = 3
    if ch == '&':
        kind = 4
    if ch == '=':
        kind = 5
    if ch == '+':
        kind = 6
    return kind


def plain(ch):
    letters = 'ABCDEFGHIJKLMNOP' + 'QRSTUVWXYZ' + 'abcdefghijklmnop' + 'qrstuvwxyz' + '0123456789' + '-._~'
    for u in letters:
        if ch == u:
            return 1
    return 0


def encoded(ch):
    chars = ' \n\r\t' + '!"#' + '%' + "&'()*+,/" + ':;' + '<' + '=' + '>' + '?@' + '[' + '\\' + ']' + '^`' + '{|}'
    hexes = '200A0D09' + '212223' + '25' + '262728292A2B2C2F' + '3A3B' + '3C' + '3D' + '3E' + '3F40' + '5B' + '5C' + '5D' + '5E60' + '7B7C7D'
    i = 0
    n = len(chars)
    while i < n:
        if chars[i] == ch:
            return '%' + hexes[i * 2:i * 2 + 2]
        i = i + 1
    return ''


def solve(s):
    out = ''
    for ch in s:
        kind = kind_of(ch)
        if kind == 1:
            out = out + '%20'
        else:
            if kind == 2:
                out = out + '%0A'
            else:
                if kind == 3:
                    out = out + '%25'
                else:
                    if kind == 4:
                        out = out + '%26'
                    else:
                        if kind == 5:
                            out = out + '%3D'
                        else:
                            if kind == 6:
                                out = out + '%2B'
                            else:
                                if plain(ch) == 1:
                                    out = out + ch
                                else:
                                    got = encoded(ch)
                                    if got == '':
                                        out = out + ch
                                    else:
                                        out = out + got
    return out

12 test cases ship with it; the first three:

inout
xqink ivrw
xqink  uslpki 0
xqink%20ivrw%0Axqink%20%20uslpki%200
zjl jbnwi
zjl  levrq 1
zjl%20jbnwi%0Azjl%20%20levrq%201
oncunt wxnb
oncunt  udahwb 2
oncunt%20wxnb%0Aoncunt%20%20udahwb%202
id
percent_encode
artifact
bbd869dc02a4…d230d
signed by
fb922a8bb381…a05be
status
from the catalog, public
For agents
GET https://research.zaiba.cloud/api/v1/programs/percent_encode
POST https://research.zaiba.cloud/api/v1/programs/percent_encode/run
  {"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/percent_encode/code
# 200 · text/plain · the tool as one Python file, written by the library's authors