1 parent 375ad26 commit ea112e5Copy full SHA for ea112e5
1 file changed
patsy/contrasts.py
@@ -92,8 +92,12 @@ def t(obj, expected):
92
t("asdf", "asdf")
93
t(u"asdf", "asdf")
94
if sys.version_info >= (3,):
95
- # a utf-8 encoded euro-sign comes out as a real euro sign
96
- t(u"\u20ac".encode("utf-8"), "\u20ac")
+ # a utf-8 encoded euro-sign comes out as a real euro sign. We have to
+ # use u""-style strings here, even though this is a py3-only block,
97
+ # because otherwise 2to3 may be clever enough to realize that in py2
98
+ # "\u20ac" produces a literal \, and double it for us when
99
+ # converting.
100
+ t(u"\u20ac".encode("utf-8"), u"\u20ac")
101
# but a iso-8859-15 euro sign can't be decoded, and we fall back on
102
# repr()
103
t(u"\u20ac".encode("iso-8859-15"), "b'\\xa4'")
0 commit comments