Esempio n. 1
0
 def encode(cls, string, encoding=None):
     """Encode the string"""
     # FIXME: dialects are a bad idea, not possible for subclasses
     # to override key methods
     if encoding != "utf-8":
         return quote.javapropertiesencode(string or u"")
     return quote.java_utf8_properties_encode(string or u"")
Esempio n. 2
0
 def encode(cls, string, encoding=None):
     """Encode the string"""
     # FIXME: dialects are a bad idea, not possible for subclasses
     # to override key methods
     if encoding not in ("utf-8", "utf-16"):
         return quote.javapropertiesencode(string or "")
     return quote.java_utf8_properties_encode(string or "")
Esempio n. 3
0
 def encode(cls, string, encoding=None):
     return quote.java_utf8_properties_encode(string or "")
Esempio n. 4
0
 def encode(cls, string, encoding=None):
     """Encode the string"""
     string = quote.java_utf8_properties_encode(string or "")
     string = quote.mozillaescapemarginspaces(string or "")
     return string
Esempio n. 5
0
 def test_java_utf8_properties_encode():
     assert quote.java_utf8_properties_encode("abc") == "abc"
     assert quote.java_utf8_properties_encode("abcḓ") == "abcḓ"
     assert quote.java_utf8_properties_encode("abc\n") == "abc\\n"
Esempio n. 6
0
 def test_java_utf8_properties_encode(self):
     assert quote.java_utf8_properties_encode(u"abc") == u"abc"
     assert quote.java_utf8_properties_encode(u"abcḓ") == u"abcḓ"
     assert quote.java_utf8_properties_encode(u"abc\n") == u"abc\\n"
Esempio n. 7
0
 def encode(cls, string, encoding=None):
     return quote.java_utf8_properties_encode(string or u"")
Esempio n. 8
0
 def encode(cls, string, encoding=None):
     """Encode the string"""
     string = quote.java_utf8_properties_encode(string or u"")
     string = quote.mozillaescapemarginspaces(string or u"")
     return string
Esempio n. 9
0
 def test_java_utf8_properties_encode(self):
     assert quote.java_utf8_properties_encode(u"abc") == u"abc"
     assert quote.java_utf8_properties_encode(u"abcḓ") == u"abcḓ"
     assert quote.java_utf8_properties_encode(u"abc\n") == u"abc\\n"