Skip to content

Commit aa4d643

Browse files
committed
taking another stab at this.
1 parent 2f848a4 commit aa4d643

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

textile/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ def _casesdefault(c, pop, popped, url_chars, counts, pre):
874874
url = self.shelveURL(self.encode_url(urlunsplit(uri_parts)))
875875
attributes = parse_attributes(atts)
876876
if title:
877-
title = title.encode('utf8')
877+
title = six.text_type(title)
878878
attributes['title'] = title
879879
attributes['href'] = url
880880
if self.rel:

textile/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def generate_tag(tag, content, attributes=None):
5353
enc = 'unicode'
5454
if six.PY2:
5555
enc = 'UTF-8'
56-
attributes = OrderedDict((k, v.decode('utf8')) for k, v in attributes.items())
56+
attributes = OrderedDict((k, six.text_type(v)) for k, v in attributes.items())
5757
if not tag:
5858
return content
5959
element = ElementTree.Element(tag, attrib=attributes)
@@ -64,7 +64,8 @@ def generate_tag(tag, content, attributes=None):
6464
try:
6565
element_tag = ElementTree.tostringlist(element, encoding=enc,
6666
method='html')
67-
element_tag = [v.decode('utf8') for v in element_tag]
67+
if six.PY2:
68+
element_tag = [v.decode('utf8') for v in element_tag]
6869
element_tag.insert(len(element_tag) - 1, content)
6970
element_text = ''.join(element_tag)
7071
except AttributeError:

0 commit comments

Comments
 (0)