login about faq

I have downloaded the last library and I noticed that when attaching a file in ANSI format arrives to the recipient in other (UTF-8) character set. I have tried changing character code via put_UTF8(false) and put_Charset but no change. If I compile in an older version of the library everything is ok.....

asked Sep 16 '13 at 07:54

lukak's gravatar image

lukak
1111

edited Sep 16 '13 at 08:34

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


The "Utf8" property is very different than the "Charset" property. The Utf8 property is common to all Chilkat C++ classes and informs the object instance how to interpret strings passed to the object (and also whether to return ANSI or utf-8 strings). Remember: A "string" in C/C++ is a "const char *", which is a pointer to a sequence of bytes terminated by a null char. We implicitly assume 1-byte per char (meaning ANSI), but it doesn't have to be. If your program is passing utf-8 strings (meaning that characters are represented by bytes using the utf-8 encoding), then the Utf8 property must be set to true.

Note that the Utf8 property has nothing to do with the actual Charset of the email. You COULD pass strings using utf-8, but then send the email using "iso-8859-1" by setting the Charset property. What happens is that the utf-8 string is provided to the Email object correctly, and then when the MIME of the email is rendered, the string is converted from it's internal utf-8 storage to iso-8859-1 for the MIME.

link

answered Sep 16 '13 at 08:43

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Yes I know that. I just wanted to say that there could be a bug in library, because when attaching a file in an e-mail message via CkEmail object, the library changes the character encoding of that file. And when opening attached file wrong characters are displayed....

link

answered Sep 16 '13 at 10:24

lukak's gravatar image

lukak
1111

I wasn't able to reproduce the problem.

The AddFileAttachment method shouldn't modify the contents of the file. It should attach the content of the file exactly as-is byte-for-byte.

An email client will display the text in an attached text file according to the charset specified within the MIME sub-header for that particular attachment. By default, no charset is specified. Therefore, an email client would be expecting the bytes of the attachment to be the ANSI representation of the chars. If they are not, then the text will not be rendered correctly. You would need to add the charset for a particular attachment by calling the SetAttachmentCharset method (after adding the attachment).

link

answered Sep 16 '13 at 10:57

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I have tried and added SetAttachmentCharset but it doesn't work. You dnl the file I am trying to attach here: https://www.dropbox.com/s/38556i03152zmjq/zaposto_ok2013916.csv The file is saved in windows-1250. All special characters disappear after sending (ŠČĆščć).

BUT, if I compile the same code with older chilkat library, everything is ok....

link

answered Sep 16 '13 at 11:51

lukak's gravatar image

lukak
1111

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:

×14
×8

Asked: Sep 16 '13 at 07:54

Seen: 1,448 times

Last updated: Sep 16 '13 at 11:51

powered by OSQA