login about faq

Hey everyone, I wanted to ask you if someone can explain how the CkEmail does handle the charset for the function LoadEML().

I need to load my created eml-file from the path "f:\tester öffentlich.eml "

The Output Shows an ANSI error! So it does Interpret the word "öffentlich" as "ffentlich" and Fails to load it.

Is there a way to load an EML even with this special german chars? Without the special char/ vowel in the filename it works. Just want to make sure it is not a bug and maybe I am doing something wrong on my end?

Tried this:

email.put_Charset("utf-8");

and

email.put_Utf8(true);

Output for lastErrorText as follows:

ChilkatLog:

LoadEml:

DllDate: Jul 31 2014

ChilkatVersion: 9.5.0.43

Architecture: Little Endian; 32-bit

Language: Visual C++ 9.0 (32-bit)

VerboseLogging: 0

loadEml2:

  emlPath: f:\tester öffentlich.eml

  loadFileX:

    Failed to open file (2)

    localFilePath: f:\tester ffentlich.eml

    currentWorkingDirectory: C:\Users\Release

    osErrorInfo: Das System kann die angegebene Datei nicht finden.

    localWindowsFilePath: f:\tester ffentlich.eml

    Failed to open for read.

  --loadFileX

--loadEml2

Failed.

--LoadEml

--ChilkatLog

asked Sep 11 '14 at 14:51

RootTag's gravatar image

RootTag
35121623

edited Sep 11 '14 at 15:47


If you hard-coded the filename as a literal string within your C++ source code, it was probably saved in the ANSI charset. Therefore, when the string is passed to LoadEml, you are passing ANSI chars. You would not want to set the "Utf8" property equal to true. The Utf8 property tells the Chilkat object instance how it should interpret any "const char " parameters passed by the app -- as either ANSI or utf-8. (it also controls the charset of any "const char " lowercase alternative method/property return values)

The email object's Charset property controls the charset to be used when rendering the email to MIME, such as when sending email or saving to .eml. It is not related to the interpretation of "const char *" method args.

link

answered Sep 11 '14 at 22:26

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Thank you. I might have my solution by doing it this way (changing put_Utf8() from case to case in the very same function):

//create file with german and other Special chars (eg.: ä,ü,ö)
CkEmail email;
email.put_Utf8(true);//for spec chars in values inside mail

//fill object for mail
email.put_Subject(mycstringhere);// has Special chars maybe german, russian or hebrew in it!
/...

//save that eml to a filename with special chars for german language
email.put_Utf8(false);
success = email.SaveEML(pathgerman)//pathgerman is a CString that holds Special chars as "c:\test\öffentlich\öäüß.eml" for the path
link

answered Sep 12 '14 at 04:49

RootTag's gravatar image

RootTag
35121623

I don't think you are clearly understanding the meaning and purpose of the "Utf8" property (i.e. get_Utf8(), put_Utf8())

A "const char *" in C/C++ is a sequence of bytes terminated by a null byte. The Utf8 property tells Chilkat how to interpret the bytes -- as characters represented in the utf-8 encoding, or as characters represented in the ANSI encoding. The Utf8 property is only concerned with the passing of "const char *" arguments and making sure the bytes are interpreted correctly. Therefore, the "Utf8" property is common to all Chilkat C++ classes.

link

answered Sep 12 '14 at 08:40

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

edited Sep 12 '14 at 08:41

Receiving the path for where to save my eml via CString pathgerman; (Content e.g. c:\test\äöüß.eml) which is used in email.SaveEML(pathgerman);

How else should I handle it (CString), before the call with SaveEML()? I am not using a "const char" or CkString right now.

(Sep 12 '14 at 14:19) RootTag
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×184
×4
×4
×2

Asked: Sep 11 '14 at 14:51

Seen: 1,942 times

Last updated: Sep 12 '14 at 14:20

powered by OSQA