]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph: Make stdout/stderr always output Unicode (UTF-8) 6315/head
authorDavid Coles <dcoles@gaikai.com>
Wed, 11 Nov 2015 22:06:45 +0000 (14:06 -0800)
committerDavid Coles <dcoles@gaikai.com>
Fri, 13 Nov 2015 01:26:37 +0000 (17:26 -0800)
commit615f8f45bab2911a6087f1a12d2bd28a10a0318c
tree031b0a5d4b8b1cf3297fdb9ad0b58550e2d9ef1c
parent0b3435f114b91c473b1ec7d73e8e6dbb4089628f
ceph: Make stdout/stderr always output Unicode (UTF-8)

If a stream is not interactive, then under Python 2, then the encoding for
stdout/stderr may be None. This means that it's not possible to print Unicode
characters since the encoding will fall back to ASCII.

This explicitly makes sys.stdout/sys.stderr always use UTF-8 encoding for
strings, regardless of the system's local or if the console is interactive or
not.
This matches the existing tests that assume that output of non-ASCII pool names
will be UTF-8 encoded.

When outputting raw binary data (such as the CRUSH-map), we must bypass the
codec and write directly to raw streams (since the new stream will only accept
ASCII byte-strings or Unicode strings).

Signed-off-by: David Coles <dcoles@gaikai.com>
src/ceph.in