# IDNA is quite clear that implementations must be strict
raise UnicodeError, "unsupported error handling "+errors
+ if not input:
+ return "", 0
+
result = []
labels = dots.split(input)
if labels and len(labels[-1])==0:
if errors != 'strict':
raise UnicodeError, "Unsupported error handling "+errors
+ if not input:
+ return u"", 0
+
# IDNA allows decoding to operate on Unicode strings, too.
if isinstance(input, unicode):
labels = dots.split(input)
def test_builtin(self):
self.assertEquals(unicode("python.org", "idna"), u"python.org")
+ def test_stream(self):
+ import StringIO
+ r = codecs.getreader("idna")(StringIO.StringIO("abc"))
+ r.read(3)
+ self.assertEquals(r.read(), u"")
+
class CodecsModuleTest(unittest.TestCase):
def test_decode(self):
Library
-------
+- Bug #1163178: Make IDNA return an empty string when the input is empty.
+
- Bug #1121494: distutils.dir_utils.mkpath now accepts Unicode strings.
- Bug #1178484: Return complete lines from codec stream readers