Decoding "quoted-printable" -- Help needed -- Reopened

R.H. roland.huettmann at
Thu Nov 14 14:41:22 EST 2019

Oh, sorry, I was too quick declaring a solution.

Even though the code of the function works fine, the result also converts
back, but the "quoted-printable" or "UTF-8" code expects that each
codepoint is encoded in Hex with just two ASCII letters representing a

For example, for the Euro symbol "€" we have three codepoints.
The function below converts to "=E2=201A=AC" while it must be "=E2=82=AC".
The "=" sign is just a delimiter in quoted-printable.

Now, I do not know what is wrong in my thinking as I am not getting quite
the same results.
(The result is ok for other symbols such as 'ü'.)


put "€" into tChar
       // First encode to UTF-8:
put textEncode(tChar,"UTF-8") into tCodedChar
       // Repeat for each codepoint in the UTF-8 char
repeat for each codePoint tCodePoint in tCodedChar
       // Encode each codepoint to its integer expression and convert to
Hex value:
      put "="& BaseConvert ( codePointToNum (tCodePoint) , 10 , 16 ) after
end repeat
put tEncoded into field "Show Codepoints" -- Expected ASCII representing
Hex numbers
-- Result: "=E2=201A=AC" -- Instead of "=E2=82=AC" , but valid and working.

The actual "correct" UTF-8 result can be tested here:

What am I missing?

Thanks a lot

More information about the use-livecode mailing list