Skip to content

Main content

RFC 2047 Encoded Word Charset Token Tool

Compute rfc 2047 encoded word charset token from explicit bounded inputs.

Loading tool…

Description

Assemble a length-bounded MIME encoded-word from supplied charset, encoding and already encoded payload text.

MIME encoded-words represent non-ASCII header text using a declared charset and B or Q encoding. Q encoding has special treatment for space and some punctuation; a valid local token is not necessarily a valid header in every context.

Assemble a length-bounded MIME encoded-word from supplied charset, encoding and already encoded payload text.

When to use this tool

Use RFC 2047 Encoded Word Charset Token when checking one encoded-word or Q encoded-text component.

How to use the tool and how it works

  1. Enter charset, encoding, payload. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read word. Use the output convention below.

Require charset to match ASCII letters, digits, dot, underscore or hyphen; encoding exactly B or Q; and payload without question marks or whitespace. Construct =?charset?encoding?payload?= and reject a result longer than 75 characters.1

Encoded-word syntax, Q escaping and header-context restrictions are separate requirements. This tool checks only its stated local part.2

Input fieldMeaning and unitsAccepted input
charsetCharsetRequired. Text; maximum UTF-16 length 8192.
encodingEncodingRequired. Text; maximum UTF-16 length 8192.
payloadAlready encoded text with no question marks or whitespace; encoding correctness is not checked.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
wordWordRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "charset": "UTF-8",
    "encoding": "B",
    "payload": "YWJj"
  },
  "output": {
    "word": "=?UTF-8?B?YWJj?="
  }
}

Limitations and assumptions

  • This is syntax assembly only. The charset need not be registered and payload is not validated as Base64 or Q encoded text; contextual header-folding and charset encoding remain separate.
  • 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 conforming MIME header encoder for charset conversion, complete payload encoding, contextual restrictions and line folding.

References

  1. Calculation and input contract: encode/rfc2047-encoded-word-charset-token — tool.io

  2. MIME encoded-word syntax: RFC 2047 — Internet Engineering Task Force

Similar or alternative tools

  • RFC 2047 Q Space Underscore Token

    Return token as a single underscore for RFC 2047 Q encoded-text representation.

  • Mime Q Literal Escape Choice

    Emit underscore for ASCII space, a literal printable ASCII character from 33-126 except =, ? and _, or otherwise an equals sign plus uppercase two-digit hexadecimal.