Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
mimic: ceph-volume: prints log messages to stdout #29602
python determins the encoding of stdout and stderr based on the LC_CTYPE and PYTHONIOENCODING env variable, by default, python3's sys.stdout uses 'utf-8' as its encoding, so it will be able to write unicode string even the stdout is not attached to a tty device. but when it comes to python2, it will default to ascii if neither of these variabls is set. so, if we are writing unicode using `_Write` in an environment where LC_CTYPE and/or PYTHONIOENCODING are using non UTF-8 encoding, it chokes by raising `UnicodeEncodeError` exception. in this change, we add a wrapper around `_Write._writer` so it is able to write unicode string in such a non-unicode-friendly environment. for more info related the encoding of stdout and stderr, see https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING . Signed-off-by: Alfredo Deza <firstname.lastname@example.org> Signed-off-by: Kefu Chai <email@example.com> (cherry picked from commit 77912c0)
jan--f merged commit
Aug 14, 2019
3 of 5 checks passed
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.