def test_url_quoting(self): from DocumentTemplate.DT_Var import url_quote from DocumentTemplate.DT_Var import url_unquote unicode_value = u'G\xfcnther M\xfcller' quoted_unicode_value = u'G%C3%BCnther%20M%C3%BCller' utf8_value = unicode_value.encode('UTF-8') quoted_utf8_value = 'G%C3%BCnther%20M%C3%BCller' self.assertEquals(url_quote(unicode_value), quoted_unicode_value) self.assertEquals(url_quote(utf8_value), quoted_utf8_value) self.assertEquals(url_unquote(quoted_unicode_value), unicode_value) self.assertEquals(url_unquote(quoted_utf8_value), utf8_value)
def test_url_quoting(self): from DocumentTemplate.DT_Var import url_quote from DocumentTemplate.DT_Var import url_unquote unicode_value = u'G\xfcnther M\xfcller' quoted_unicode_value = u'G%C3%BCnther%20M%C3%BCller' utf8_value = unicode_value.encode('UTF-8') quoted_utf8_value = 'G%C3%BCnther%20M%C3%BCller' self.assertEquals(url_quote(unicode_value), quoted_unicode_value) self.assertEquals(url_quote(utf8_value), quoted_utf8_value) self.assertEquals(url_unquote(quoted_unicode_value), unicode_value) self.assertEquals(url_unquote(quoted_utf8_value), utf8_value)