save Outlook Attachment with "Umlaute"

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Posts: 617
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 150 times
Been thanked: 552 times

Re: save Outlook Attachment with "Umlaute"

Post by edk »

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: ... 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 ) )

Local nPos
DO WHILE (nPos := AT( CHR (0xCC), cUTF8 )) > 0
	cUTF8 := Left ( cUTF8, nPos - 1) + SubStr ( cUTF8, nPos + 2 )

User avatar
Posts: 1149
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 213 times
Been thanked: 310 times

Post by AUGE_OHR »

uuuuuuff :)

i´m just a xBase Programmer.
THX for your help. i will try to understand and use your Demo Code
have fun

Post Reply