File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ def __init__(self, **kwargs):
167
167
def encode (self , string ):
168
168
assert (isinstance (string , text_type ))
169
169
if self .escape_invisible :
170
- text = utils .escapeInvisible (text , self .escape_invisible == 'named' )
170
+ string = utils .escapeInvisible (string , self .escape_invisible == 'named' )
171
171
if self .encoding :
172
172
return string .encode (self .encoding , unicode_encode_errors )
173
173
else :
Original file line number Diff line number Diff line change 2
2
3
3
from types import ModuleType
4
4
5
+ from six import text_type
6
+
5
7
from .constants import invisibleChars
6
8
7
9
@@ -87,11 +89,11 @@ def escapeInvisible(text, useNamedEntities=False):
87
89
if ord (c ) in invisibleChars :
88
90
escapable .add (c )
89
91
if useNamedEntities :
92
+ # for c in escapable:
93
+ # name = codepoint2name.get(ord(c))
94
+ # escape = "&%s;" % name if name else "&#x%X;" % ord(c)
95
+ # text = text.replace(c, escape)
90
96
raise NotImplementedError ("This doesn't work on Python 3" )
91
- for c in escapable :
92
- name = codepoint2name .get (ord (c ))
93
- escape = "&%s;" % name if name else "&#x%X;" % ord (c )
94
- text = text .replace (c , escape )
95
97
else :
96
98
for c in escapable :
97
99
text = text .replace (c , "&#x%X;" % ord (c ))
You can’t perform that action at this time.
0 commit comments