From 0095c6f66e725b2544c1622add3c16a624494860 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Fri, 24 Aug 2012 13:04:01 +0200 Subject: [PATCH] use DEFAULT_ENCODING also in vcaladdress --- src/icalendar/prop.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index c592b36..2854f10 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -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