The UTF-8 encoding translates an array of bytes (8-bit numbers) to a string (or vice versa). I.e. there is a mapping between "numbers" and "characters". The set of characters is larger than the set of ASCII characters, for example é is part of UTF-8, but not part of ASCII.
Quoted-Prinable encoding translates an array of bytes (8-bit number) to a sequence of ASCII characters (actually a subset of it).
Thus, combining both you can "encode" a UTF-8 string into a sequence of (a subset) of ASCII characters (ASCII string).
The same can be done with other encodings (e.g. ISO-8859-1). Thus you need to have both information:
- The given ASCII string is quoted printable.
- The resulting byte array represents a string having encoding UTF-8.
Decoding quoted-printable thus has two steps:
Create the byte array say bytes[] via the quoted printable rules, i.e.
- The substring =NM maps to a byte NM (where NM is hexadecimal) ("N*16 + M")
- Any other character maps to its ASCII byte
(Note that the similar q-encoded-word has an additional mapping for the _ to space)
Then interpret the byte array as UTF-8 string.