Archived Forum Post

Index of archived forum posts


Failed to add file attachment - Japanese filename

Feb 21 '13 at 07:05

I have this in my code:

email.AddFileAttachment2(sa.GetString(j), 'UTF-8');

However, as you can see from the LastError, the file can't be attached.

    DllDate: Feb 15 2010
    Username: Administrator
    Component: ActiveX
    filename: D:\MailManAttach\GetSendMailMan\Out\Attachment\漢字仮å交ã˜ã‚Šæ–‡.txt
    contentType: UTF-8
    WindowsError: The system cannot find the file specified.
    Failed to add file attachment

What is the best solution for this? The ChilKatMime can extract the parts without any problem. The problem appears when attaching the file again.


oopsss...the AddFileAttachment2 is's the sa.GetString that is returning the garbage. so now, I'm extracting the MimeParts manually and just take note of the Filename.


Make sure you tell each object involved, such as "sa" and "email" to pass strings as utf-8 and not ANSI. See

For example:

email.AddFileAttachment2(sa.GetString(j), 'image/jpg');

ALSO: The 2nd arg to AddFileAttachment2 is the MIME Content-Type for the attachment, NOT the charset.


it seems the SA I'm using (Delphi Active X) doesn't have the charset property.