utf8 encoding with no charset

darcs-hash:20060201073540-86b55-5e003fd016ae0b76ee2ce81fa6670f67d7aa4459.gz
This commit is contained in:
David Rousselie
2006-02-01 08:35:40 +01:00
parent 453d986f8d
commit 0cf07b0a25
3 changed files with 8 additions and 6 deletions

View File

@@ -25,6 +25,9 @@ coverage.erase()
coverage.start()
import unittest
import sys
reload(sys)
sys.setdefaultencoding('utf8')
del sys.setdefaultencoding
import tests
from tests.test_mailconnection import *
from tests.test_mailconnection_factory import *
@@ -34,6 +37,7 @@ from test import test_support
import jabber
import logging
if __name__ == '__main__':
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())

View File

@@ -1,5 +1,4 @@
##
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-
## email_generator.py
## Login : David Rousselie <david.rousselie@happycoders.org>
## Started on Tue May 17 15:33:35 2005
@@ -28,8 +27,7 @@ from email.MIMEMultipart import MIMEMultipart
def _create_multipart(encoded):
msg = MIMEMultipart()
if encoded:
part1 = MIMEText("Encoded multipart1 with 'iso-8859-15' charset (<EFBFBD><EFBFBD><EFBFBD>)", \
_charset = "iso-8859-15")
part1 = MIMEText("utf-8 multipart1 with no charset (éàê)", _charset = "")
msg.attach(part1)
part2 = MIMEText("Encoded multipart2 with 'iso-8859-15' charset (<28><><EFBFBD>)", \
_charset = "iso-8859-15")

View File

@@ -103,8 +103,8 @@ class MailConnection_TestCase(unittest.TestCase):
make_test((True, True, True), \
lambda self, email: self.connection.format_message(email), \
u"From : encoded from (éàê)\nSubject : encoded subject (éà" + \
u"ê)\n\nEncoded multipart1 with 'iso-8859-15' charset (éàê" + \
u")\nEncoded multipart2 with 'iso-8859-15' charset (éàê)\n")
u"ê)\n\nutf-8 multipart1 with no charset (éàê)" + \
u"\nEncoded multipart2 with 'iso-8859-15' charset (éàê)\n")
class POP3Connection_TestCase(unittest.TestCase):