Re: save Outlook Attachment with "Umlaute"
Posted: Mon Oct 12, 2020 12:38 pm
I already know a little more. This UTF-8 format what you get from MAC is commonly called UTF-8-MAC and is based on a combination of characters, ie "overprinting" a special character on the previous one. Something like overwriting characters on a dot matrix printer, like O + BackSpace + ' = Ó
Therefore, the screen shows as if it were one character.
You need to find a way to convert UTF8 combined Characters into single UTF8 characters.
Perhaps this table will be helpful: https://www.utf8-chartable.de/unicode-u ... number=128
Most COMBINING codes start with 0xCC
You can try to build your own converter (we probably won't find it in harbour), e.g. 0x55 0xCC 0x88 -> 0xC3 0x9C
The easiest way is to get rid of COMBINING characters. Not elegant, because we lose national letters, but effective.
Therefore, the screen shows as if it were one character.
You need to find a way to convert UTF8 combined Characters into single UTF8 characters.
Perhaps this table will be helpful: https://www.utf8-chartable.de/unicode-u ... number=128
Most COMBINING codes start with 0xCC
You can try to build your own converter (we probably won't find it in harbour), e.g. 0x55 0xCC 0x88 -> 0xC3 0x9C
The easiest way is to get rid of COMBINING characters. Not elegant, because we lose national letters, but effective.
Code: Select all
t0 := "=?utf-8?Q?"
t99 := "?="
t1 := t0 + "U=CC=88berscha=CC=88tzung" + t99 //UTF8MAC
t2 := t0 + "=C3=9Cbersch=C3=A4tzung" + t99 //UTF8
d1 := dekodujMIME( t1 )
d2 := dekodujMIME( t2 )
msginfo (t1 + crlf + d2)
msginfo (t2 + crlf + d2)
msgdebug (d1, d2, d1=d2 )
msgdebug ( CutOfUTF8MAC( d1 ) )
*****************************************
FUNCTION CutOfUTF8MAC( cUTF8 )
Local nPos
DO WHILE (nPos := AT( CHR (0xCC), cUTF8 )) > 0
cUTF8 := Left ( cUTF8, nPos - 1) + SubStr ( cUTF8, nPos + 2 )
ENDDO
RETURN cUTF8