login about faq

Using C++, how do I attach a file to a CkEmail if it has a Unicode name that can't be converted to ANSI using the current code page? The only methods I see are AddFileAttachment and AddFileAttachment2, both of which use char* for the file name.

asked May 01 '14 at 06:45

chrisd's gravatar image


If you have a utf16 filename, convert it to utf8, then you can attach it with AddFileAttachment. You also need to call ::put_Utf8(true) method to inform CkEmail that char* strings are utf8 encoded.


(May 04 '14 at 10:07) sune

Thanks Sune! Yes, you can pass the strings as utf-8 ( see http://www.cknotes.com/utf8-c-property-allows-for-utf-8-or-ansi-const-char/ )

or you may use the Unicode (wchar_t) Chilkat classes which have names ending in "W" (such as CkEmailW) and use "const wchar_t " instead of "const char ".

In summary, Chilkat provides the option to pass ANSI (single-byte per char strings), utf-8, or wchar_t.


answered May 04 '14 at 18:52

chilkat's gravatar image

chilkat ♦♦

CkEmailW? Who knew? I have to say that it's rather well hidden. It's not listed in the C++ class list. The only way to find it is to click "Unicode C++" in the components and libraries documentation page, but who's going to scan all the way down to the bottom of the list when you're using C++ and you've already found "C++" near the top? It's not a different language.

(May 05 '14 at 07:06) chrisd
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: May 01 '14 at 06:45

Seen: 2,758 times

Last updated: May 05 '14 at 07:06

powered by OSQA