1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/unicode.py Tue Dec 13 00:58:52 2016 +0100
1.3 @@ -0,0 +1,20 @@
1.4 +# -*- coding: ISO-8859-1 -*-
1.5 +
1.6 +import sys
1.7 +
1.8 +# Print bytes.
1.9 +
1.10 +s = "æøå"
1.11 +print s # æøå
1.12 +
1.13 +# Obtain text and print it.
1.14 +
1.15 +u = unicode(s, "ISO-8859-1")
1.16 +print u # æøå
1.17 +print u.encode("ISO-8859-1") # æøå
1.18 +
1.19 +# Inspect and update the encoding of stdout.
1.20 +
1.21 +print sys.stdout.encoding # None
1.22 +sys.stdout.encoding = "ISO-8859-1"
1.23 +print u # æøå