use DEFAULT_ENCODING also in vcaladdress

pull/61/head
Johannes Raggam 2012-08-24 13:04:01 +02:00
rodzic 512f2ddcca
commit 0095c6f66e
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -80,6 +80,8 @@ from icalendar.parser import Parameters
SequenceTypes = [TupleType, ListType]
DEFAULT_ENCODING = 'utf-8'
DATE_PART = r'(\d+)D'
TIME_PART = r'T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?'
DATETIME_PART = '(?:%s)?(?:%s)?' % (DATE_PART, TIME_PART)
@ -194,7 +196,7 @@ class vCalAddress(str):
def __new__(cls, value):
if isinstance(value, unicode):
value = value.encode('utf-8')
value = value.encode(DEFAULT_ENCODING)
self = super(vCalAddress, cls).__new__(cls, value)
self.params = Parameters()
return self
@ -1072,8 +1074,6 @@ class vRecur(CaselessDict):
from_ical = staticmethod(from_ical)
DEFAULT_ENCODING = 'utf-8'
class vText(unicode):
"""Simple text.
@ -1105,7 +1105,7 @@ class vText(unicode):
A string with; some\\ characters in
it
We are forgiving to UTF8 encoding errors:
We are forgiving to utf-8 encoding errors:
>>> # We intentionally use a string with unexpected encoding
>>> t = vText.from_ical('Ol\\xe9')
>>> t