This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients belopolsky, doerwalter, ncoghlan, pitrou, vstinner
Date 2010-11-05.18:43:08
SpamBayes Score 1.8868852e-05
Marked as misclassified No
Message-id <1288982590.85.0.299607092654.issue10329@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2010-11-05 18:43:10pitrousetrecipients: + pitrou, doerwalter, ncoghlan, belopolsky, vstinner
2010-11-05 18:43:10pitrousetmessageid: <1288982590.85.0.299607092654.issue10329@psf.upfronthosting.co.za>
2010-11-05 18:43:08pitroulinkissue10329 messages
2010-11-05 18:43:08pitroucreate