Description
Accept integer text only as zero or an optional minus followed by a nonzero decimal digit and further digits.
Length-prefixed and delimiter-framed encodings depend on precise counts and canonical token spelling. Text characters and encoded byte lengths can differ, so a supplied numeric length is not verification of the payload.
Accept integer text only as zero or an optional minus followed by a nonzero decimal digit and further digits.
When to use this tool
Use Bencode Canonical Integer Token when assembling one explicit length or canonical integer token.
How to use the tool and how it works
- Enter integer. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read token. Use the output convention below.
Accept integer text only as zero or an optional minus followed by a nonzero decimal digit and further digits. Return token = i+integer+e as a bencode integer spelling.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| integer | Integer | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| token | Token | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"integer": "-42"
},
"output": {
"token": "i-42e"
}
} Limitations and assumptions
- Leading zeros, plus signs, negative zero and whitespace are rejected. The text is not converted to a numeric magnitude; this emits one integer token without a complete bencoded container.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use a complete parser or serializer to verify the actual payload, delimiters and container structure.
References
Similar or alternative tools
- Encoding: Netstring Length Prefix
Return its decimal spelling followed by a colon as prefix.
- Punycode Digit To Generalized Integer Tool
Calculate punycode digit to generalized integer from explicit caller-supplied inputs.