D6043: UnicodeEncoding:change the default encoding of the whole script to be 'UTF-8'(issue6040)
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Sat Mar 2 15:41:16 EST 2019
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.
If we wanted to call ``sys.setdefaultencoding()``, we should call it once during ``hg`` or at the top of ``mercurial/__init__.py``.
But we don't want to call ``sys.setdefaultencoding()``. This topic has been discussed heavily over the years. The various answers at https://stackoverflow.com/questions/3828723/why-should-we-not-use-sys-setdefaultencodingutf-8-in-a-py-script have a lot of context and I won't rehash the reasons here.
May I ask what compelled you to want to do this? Any bug you encountered that was fixed by this change represents a place where Mercurial isn't handling encoding properly. We should fix the actual places where that is occurring. Because even if we switch to UTF-8 as the default string encoding, UTF-8 isn't used everywhere and the underlying encoding problem may still exist!
Any patch to introduce ``sys.setdefaultencoding()`` into the code base will likely never be accepted (unless it is doing something special like what ``HGUNICODEPEDANTRY`` is doing). So you may want to mark this code review as abandoned.
To: akshjain.jain74, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
More information about the Mercurial-devel