save Outlook Attachment with "Umlaute"

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

save Outlook Attachment with "Umlaute"

Post by AUGE_OHR »

hi

i use activeX to get Attachment from Outlook and save it to Disk

Code: Select all

   Attachment:Item( i ):SaveAsFile( cOut + cName )
Problem : when have "Umlaute" i can see in CMD Box still a Square instead of "Umlaut"
Explorer and HMG App using UTF8 does show it right.

pass Filename to SumatraPDF with "Umlaut" work but FreeImage does not load it. :(
FreeImage does load File when create a new File with "Umlaute" which also show in CMD Box right.

---

have try to run HMG App under different Codepage but most get "?" sign so it was not saved
i have to use UTF8 which is default when compile Unicode Version

is there any Way to get right "Umlaute" in Filename :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: save Outlook Attachment with "Umlaute"

Post by AUGE_OHR »

hi,

i try to use

Code: Select all

   IF HB_UAT("ü",cName) > 0  // not work
      cName := HB_UTF8STRTRAN(cName,"ü","ue")
where i use Notepad++ and UTF8 (also try ANSI) for that Code.

but it does work so i wrote Debug Code to get ASC() of each Sign.

Code: Select all

PROCEDURE DoTestSign(cName)
LOCAL nSign, i , iMax, aSign := {}
 
   IF HB_UAT("Rot", cName) > 0
      iMax := HB_ULEN(cName)
      FOR i := 1 TO iMax
         nSign := ASC( HB_UTF8SUBSTR(cName,i,1) )
         AADD(aSign, nSign)
      NEXT
      MsgInfo( hb_valToExp(aSign),cName)
   ENDIF
RETURN
all Sign > 128 are interessing and i found CHR(204)

Code: Select all

   IF CHR(117)+CHR(204) $ cName
      cName := HB_UTF8STRTRAN(cName,CHR(117)+CHR(204),"ue")
   ENDIF
this work but i still had CHR(204) in CMD Box

than i change Code in 2 Parts

Code: Select all

   IF CHR(117)+CHR(204) $ cName
      cName := HB_UTF8STRTRAN(cName,CHR(117),"ue")
   ENDIF

   // this is need to delete Square in CMD Box	
   nPosi := HB_UAT(CHR(204),cName)
   IF nPosi > 0
      cName := HB_UTF8SUBSTR(cName,1,nPosi-1)+HB_UTF8SUBSTR(cName,nPosi+1)
   ENDIF
now i got a Filename which i can access with my harbour App :D

attached Code
UMLAUTE.ZIP
(665 Bytes) Downloaded 103 times
why does it not work direct with "ü" :idea:
do i still have wrong Editor for UTF8 and German "Umlaut" :?:
have fun
Jimmy
Tiger
Posts: 70
Joined: Mon Aug 31, 2015 11:28 am
Location: Taipei

Re: save Outlook Attachment with "Umlaute"

Post by Tiger »

Do you try to set the "codepage" ?

==> SET CODEPAGE TO UNICODE
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: save Outlook Attachment with "Umlaute"

Post by AUGE_OHR »

Tiger wrote: Wed Oct 07, 2020 5:58 am Do you try to set the "codepage" ?

==> SET CODEPAGE TO UNICODE
YES ... and it had a Side Effect with my Combobox
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: save Outlook Attachment with "Umlaute"

Post by AUGE_OHR »

i need to change some DLLCALL Code from "A" to "W" ...
https://www.hmgforum.com/viewtopic.php? ... 26&start=8

about UMLAUTE.ZIP
i just test once for "Umlaut" but you might have more that one
have fun
Jimmy
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: save Outlook Attachment with "Umlaute"

Post by edk »

AUGE_OHR wrote: Wed Oct 07, 2020 12:04 am hi

i use activeX to get Attachment from Outlook and save it to Disk

Code: Select all

   Attachment:Item( i ):SaveAsFile( cOut + cName )
Problem : when have "Umlaute" i can see in CMD Box still a Square instead of "Umlaut"
Explorer and HMG App using UTF8 does show it right.

pass Filename to SumatraPDF with "Umlaut" work but FreeImage does not load it. :(
FreeImage does load File when create a new File with "Umlaute" which also show in CMD Box right.

---

have try to run HMG App under different Codepage but most get "?" sign so it was not saved
i have to use UTF8 which is default when compile Unicode Version

is there any Way to get right "Umlaute" in Filename :idea:
Hi.
Does the same problem with the names of saved attachments occur when you manually save them from Outlook?
If you save attachment via ActiveX, is the code page of your application also set to UTF8?
Send me examples on the e-mail that I provided on P.M.
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: save Outlook Attachment with "Umlaute"

Post by AUGE_OHR »

hi,
edk wrote: Fri Oct 09, 2020 9:46 am Does the same problem with the names of saved attachments occur when you manually save them from Outlook?
Yes
edk wrote: Fri Oct 09, 2020 9:46 am If you save attachment via ActiveX, is the code page of your application also set to UTF8?
in last HMG Version Yes but before i had Codepage German.

---

when send Email from Windows i´m not allowed to use Quote in Filename like above.
so i have to look for Original Email (old) and try to re-send it.
waiting for new Sample from my Friend who have a APPLE PC and iOS
have fun
Jimmy
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: save Outlook Attachment with "Umlaute"

Post by edk »

Hi.
For me, both from Outlook and from my POP client, it saves your attachments correctly. Displaying a directory in UTF8 and DEWIN (ISO) encoding also correctly shows all characters contained in the name. However, when using the DE850 encoding, some characters (long dashes, opening and closing quotes) are invalid, which is understandable as they are not supported in the ASCII 256 table.
dir2.png
dir2.png (73.5 KiB) Viewed 1841 times
The dir() system command also shows ok.
dir.png
dir.png (224.82 KiB) Viewed 1841 times
Attached I am sending a demo of my POP3 client in which I decode the attachment names, message subject and sender name from MIME format to a supported code page.

The pop3 client parameters (pop3 server, port, SSL support, login and password) are defined in the email() function.
Attachments
tipMail_pop_En.7z
(570.61 KiB) Downloaded 94 times
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: save Outlook Attachment with "Umlaute"

Post by AUGE_OHR »

hi,

Thx for your work, i will study your Code

Question : can you open Attachment under HMG :?:
have fun
Jimmy
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: save Outlook Attachment with "Umlaute"

Post by edk »

AUGE_OHR wrote: Sun Oct 11, 2020 5:54 pm Question : can you open Attachment under HMG :?:
The attachment Rot-Grün – die letzte Bastion der „Biodeutschen“ - Hamburger Abendblatt.pdf can be opened by FOPEN with CP: UTF8, DEWIN (ISO)
The attachment Rot-Grün – die letzte Bastion der „Biodeutschen“ - Hamburger Abendblatt.pdf can't be opened by FOPEN with CP DE850

The attachment Überschätzung.pdf can be opened by FOPEN with CP: UTF8, DEWIN (ISO) and DE850
Post Reply