Re: Encoding problem of attachment file names

"'Chip' [email protected] [blat]" <[email protected]>
Newsgroups gmane.mail.blat
Message-ID <F8C07AE48296417BA18A0CFC7A7C1614@chip>
> I use exported function SendW of blat.dll (thus compiled wit Unicode 
> support) vs. 3.2.1.
>
> * If I use the "charset=UTF-8" option the message body file (encoded as 
> UTF-8) is correctly displayed in mail client (Outlook 2010) as expected. 
> However the attachment file name that only contains characters from the 
> local code page (German umlauts) and that is passed by option "-attach 
> äöüß.zip" as wide string is displayed as mojibake in mail client. If the 
> attachment file name contains Unicode characters then everything is fine 
> again.
>
> * If I use the "charset=ISO-8859-1" option the message body file (encoded 
> as UTF-8) is displayed as mojibake in mail client as expected. However 
> this time the attachment file names passed by option "-attach äöüß.zip" as 
> wide string are correctly displayed in mail client.
>
> Is this a problem in blat or my calling application? How can I force the 
> attachment file names (of local code page) to be correctly encoded if 
> "charset=UTF-8" is set? I did not yet try to call 
> WideCharToMultiByte(CP_ACP, ...) and MultiByteToWideChar(CP_UTF8, ...) on 
> the file name wide string to convert to UTF-8.


Have you tried to save the attachment names to a UTF-8 or Unicode file, then 
use –af option?

If Blat.dll is compiled with Unicode support, then SendW() is expecting all 
strings to be in 16-bit Unicode format.  If you are calling SendW() with 
multibyte strings, this will be a problem.  When I test Blat.dll, my test 
program is compiled for Unicode to eliminate such issues.

As a note, if your code is written for MBCS, then you should be calling 
SendA().

-- 
Chip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.