Steps to reproduce:
export LC_CTYPE=UTF-8
export LANGUAGE=pl plainbox
This uses =pl since polish seems to be the only language that has a non-trivial amount of translations that are not pure ASCII and thus triggers the problem by trying to convert non 7-bit ASCII to ASCII.
The looks like this:
Traceback (most recent call last):
File "/home/kissiel/FUBAR/checkbox/venv/bin/plainbox", line 9, in <module>
load_entry_point('plainbox==0.21.dev', 'console_scripts', 'plainbox')()
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/box.py", line 122, in main
raise SystemExit(PlainBoxTool().main(argv))
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/clitools.py", line 324, in main
return self.dispatch_and_catch_exceptions(ns)
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/clitools.py", line 560, in dispatch_and_catch_exceptions
return self.dispatch_command(ns)
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/clitools.py", line 556, in dispatch_command
return ns.command.invoked(ns)
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/commands/cmd_run.py", line 45, in invoked
self.provider_loader, self.config_loader, ns, ns.color).run()
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/commands/inv_run.py", line 356, in run
return self.do_normal_sequence()
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/commands/inv_run.py", line 403, in do_normal_sequence
self.export_and_send_results()
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/commands/inv_run.py", line 814, in export_and_send_results
self._save_results(self.ns.output_file, exported_stream)
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/commands/inv_run.py", line 831, in _save_results
copyfileobj(input_stream, translating_stream)
File "/home/kissiel/FUBAR/checkbox/venv/lib/python3.4/shutil.py", line 69, in copyfileobj
fdst.write(buf)
File "/home/kissiel/FUBAR/checkbox/plainbox/plainbox/impl/exporter/__init__.py", line 359, in write
return self.dest_stream.write(data.decode(self.encoding))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2611' in position 8: ordinal not in range(128)
(venv)kissiel@lilly:~/FUBAR/checkbox$
locale output:
http://paste.ubuntu.com/10828447/
The ‘data’ var from the trace contains following : b' \x1b[32;1m\xe2\x98\x91 \x1b[0m: led/caps-lock\n'
Let's set LC_CTYPE to the bogus value inherited from OS X
zyga@fx:~$ export LC_CTYPE=UTF-8
bash: uwaga: setlocale: LC_CTYPE: nie można zmienić lokalizacji (UTF-8): Nie ma takiego pliku ani katalogu
^^ (sorry about the polish locale, here bash tells us that it cannot set LC_CTYPE like that)
Let's run python now.
zyga@fx:~$ python3
Python 3.4.3 (default, Mar 26 2015, 22:03:40)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
Hmm, we're all good, right python?
>>> import sys
>>> sys.stdout.encoding
'ANSI_X3.4-1968'
Nope, we're f***d