1.1 --- a/tests/unicode.py Wed Dec 14 00:00:21 2016 +0100
1.2 +++ b/tests/unicode.py Wed Dec 14 00:03:08 2016 +0100
1.3 @@ -6,6 +6,7 @@
1.4
1.5 s = b"ÆØÅ"
1.6 print s # ÆØÅ
1.7 +print len(s) # 3
1.8
1.9 # Obtain text and print it.
1.10
1.11 @@ -13,22 +14,28 @@
1.12
1.13 u = unicode("æøå", "ISO-8859-1")
1.14 print u # æøå
1.15 +print u.__class__ # __builtins__.unicode.utf8string
1.16 print u.encode("ISO-8859-1") # æøå
1.17 print u.encoding # ISO-8859-1
1.18 +print len(u) # 3
1.19
1.20 # Explicitly from Unicode literals.
1.21
1.22 u2 = u"æøå"
1.23 print u2 # æøå
1.24 +print u2.__class__ # __builtins__.unicode.utf8string
1.25 print u2.encode("ISO-8859-1") # æøå
1.26 print u2.encoding # ISO-8859-1
1.27 +print len(u2) # 3
1.28
1.29 # Implicitly from string literals.
1.30
1.31 #u3 = "æøå"
1.32 #print u3 # æøå
1.33 +#print u3.__class__ # __builtins__.unicode.utf8string
1.34 #print u3.encode("ISO-8859-1") # æøå
1.35 #print u3.encoding # ISO-8859-1
1.36 +#print len(u3) # 3
1.37
1.38 # Combine bytes and text.
1.39 # The text should be decoded.
1.40 @@ -36,6 +43,7 @@
1.41 su = s + u
1.42 print su # ÆØÅæøå
1.43 print su.__class__ # __builtins__.str.string
1.44 +print len(su) # 6
1.45
1.46 # Combine text and bytes.
1.47 # The text should be decoded.
1.48 @@ -43,6 +51,7 @@
1.49 us = u + s
1.50 print us # æøåÆØÅ
1.51 print us.__class__ # __builtins__.str.string
1.52 +print len(us) # 6
1.53
1.54 # Combine text and text.
1.55
1.56 @@ -50,6 +59,7 @@
1.57 print uu2 # æøå
1.58 print uu2.__class__ # __builtins__.unicode.utf8string
1.59 print uu2.encoding # ISO-8859-1
1.60 +print len(uu2) # 6
1.61
1.62 # Inspect and update the encoding of stdout.
1.63 # Note that su and us are byte strings and are not recoded.