login about faq

I am evaluating Chilkat email component for python. I need to read messages (via POP3) in different languages ​​(Polish, Greek, Russian), and can not find a clear solution, can you help me with an example or instruction?

asked Aug 02 '12 at 10:32

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


In Python, a string is a null-terminated sequence of bytes that represent characters in some character encoding (such as utf-8). By default, any Chilkat method that returns a string will return the string using the ANSI character encoding. The ANSI character encoding may change based on the locale of the computer where your Python script is running. For example, in the USA or Western Europe, the ANSI encoding is typically Latin-1 (or iso-8859-1).

With a few exceptions, all Chilkat classes have a "Utf8" property that can be set to True. This will cause the object instance to return all strings as utf-8 instead of ANSI. This is what you would need to do if the strings (such as the subject of an email) might be in any language.

For example: emailObject.put_Utf8(True)

You need not be concerned about the character encoding used within the email itself. It doesn't matter how the strings within the MIME of the email are represented w.r.t. character encoding or transfer encoding (Base64, quoted-printable, etc.) because Chilkat will automatically convert/decode and return the string as utf-8 or ANSI (depending on the Utf8 property setting).

The CkString class is a little special in that many of the method explicitly state the character encoding of the string that is returned. In these cases, the Utf8 property does not apply. (Such as with the CkString.getUtf8() method, which always returns the utf-8 representation of the string contained in the CkString object instance.

For more information about Python w/ character encodings, see these Chilkat examples:
Python: Defining Source Code Encoding
Python: Working with Strings in any Charset

link

answered Aug 02 '12 at 10:50

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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
×18

Asked: Aug 02 '12 at 10:32

Seen: 4,643 times

Last updated: Aug 02 '12 at 10:50

powered by OSQA