bpo-34421: Improve distutils logging for non-ASCII strings. (GH-9126)

Use "backslashreplace" instead of "unicode-escape".  It is not
implementation depended and escapes only non-encodable characters.

Also simplify the code.
2 files changed