It is possible to use string literals within your C++ code — as long as you save your C++ source file using the utf-8 character encoding.

For example, open a .cpp source file and add this line:

	CkString str1;
	str1.appendU(L"京");

When you try to save the .cpp source file, you may get a message such as:

“Some Unicode characters in this file could not be saved in the current codepage. Do you want to resave this file as Unicode in order to maintain your data?”

Click on the “Save with Other Encoding” button on the dialog box that pops up, and then select “Unicode (UTF-8 with signature) – Codepage 65001” for the encoding.

You may use the Unicode string in a Chilkat object like this:

int _tmain(int argc, _TCHAR* argv[])
{
	CkString str1;
	str1.appendU(L"京");

	CkEmail email;

	// Tell the Chilkat object that the bytes pointed to by
	// "const char *" are utf-8:
	email.put_Utf8(true);

	// Set the email's subject:
	email.put_Subject(str1.getUtf8());

	// Set the email's body:
	email.put_Body(str1.getUtf8());

	// Let's use the big5 charset for the email...
	email.put_Charset("big5");

	email.SaveEml("out.eml");

	return 0;
}