Antoine Pitrou <pit...@free.fr> added the comment:

> I would be +0 on adding errors='replace' or 'backshlashreplace' to the 
> open() call in  write_results_file(), but hardcoding encoding="utf-8"
> is definitely not the right thing to do.

Who are the consumers of the trace files? Is there a formal specification or is 
Python the primary consumer?
If the former, then follow the specification (and/or amend it ;-)).
If the latter, you have the right to be creative; then utf-8 with the sounds 
like a most reasonable choice (possibly with an error handler such as "ignore" 
or "replace" to avoid barfing on lone surrogates).

Relying on the default encoding is not really a good idea, though. This is good 
for quick scripts or in the rare cases where it is by definition the expected 
behaviour. But in more elaborate cases you certainly want to decide the 
encoding by yourself.

----------
nosy: +pitrou

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to