1.1 --- a/lib/posix/io.py Thu Dec 15 23:25:48 2016 +0100
1.2 +++ b/lib/posix/io.py Thu Dec 15 23:26:40 2016 +0100
1.3 @@ -21,6 +21,7 @@
1.4
1.5 from __builtins__.file import filestream
1.6 from __builtins__.types import check_int, check_string
1.7 +
1.8 from native import (
1.9 close as _close,
1.10 fdopen as _fdopen,
1.11 @@ -28,6 +29,8 @@
1.12 write as _write
1.13 )
1.14
1.15 +import locale
1.16 +
1.17 # Abstractions for system-level files and streams.
1.18
1.19 class sysfile:
1.20 @@ -78,6 +81,13 @@
1.21 stdout = sysstream(1, "w")
1.22 stderr = sysstream(2, "w")
1.23
1.24 +# Localised streams.
1.25 +# Perform locale initialisation explicitly to ensure that the locale module
1.26 +# and various function defaults have been initialised.
1.27 +
1.28 +locale.initlocale()
1.29 +lstdin = sysstream(0, "r", locale.getpreferredencoding())
1.30 +
1.31 # Input/output functions.
1.32
1.33 def close(fd):