1.1 --- a/tests/unicode.py Tue Dec 13 17:58:26 2016 +0100
1.2 +++ b/tests/unicode.py Tue Dec 13 19:19:23 2016 +0100
1.3 @@ -4,14 +4,14 @@
1.4
1.5 # Print bytes.
1.6
1.7 -s = b"æøå"
1.8 -print s # æøå
1.9 +s = b"ÆØÅ"
1.10 +print s # ÆØÅ
1.11
1.12 # Obtain text and print it.
1.13
1.14 # Explicitly from bytes.
1.15
1.16 -u = unicode(s, "ISO-8859-1")
1.17 +u = unicode("æøå", "ISO-8859-1")
1.18 print u # æøå
1.19 print u.encode("ISO-8859-1") # æøå
1.20
1.21 @@ -27,8 +27,22 @@
1.22 #print u3 # æøå
1.23 #print u3.encode("ISO-8859-1") # æøå
1.24
1.25 +# Combine bytes and text.
1.26 +# The text should be decoded.
1.27 +
1.28 +su = s + u
1.29 +print su # ÆØÅæøå
1.30 +
1.31 +# Combine text and bytes.
1.32 +# The text should be decoded.
1.33 +
1.34 +us = u + s
1.35 +print us # æøåÆØÅ
1.36 +
1.37 # Inspect and update the encoding of stdout.
1.38
1.39 print sys.stdout.encoding # None
1.40 sys.stdout.encoding = "ISO-8859-1"
1.41 print u # æøå
1.42 +print su # ÆØÅæøå
1.43 +print us # æøåÆØÅ