Returns the given string as a Python byte string (if possible).
(string)
| 44 | return unicode(string) |
| 45 | |
| 46 | def encode_utf8(string): |
| 47 | """ Returns the given string as a Python byte string (if possible). |
| 48 | """ |
| 49 | if isinstance(string, unicode): |
| 50 | try: |
| 51 | return string.encode("utf-8") |
| 52 | except: |
| 53 | return string |
| 54 | return str(string) |
| 55 | |
| 56 | #### IMAP4 SSL ##################################################################################### |
| 57 | # Fixes an issue in Python 2.5- with memory allocation. |
no test coverage detected
searching dependent graphs…