Code review comment for lp:~songofacandy/bzr/user_encoding_utf8

Revision history for this message
Martin Packman (gz) wrote :

Treating ascii from the posix locale as utf-8 may be okay, but adding a mechanism outside locale to override this will break things I'm afraid.

This is essentially the argument python-dev were making against allowing any kind of overriding, which is overly conservative, but get_user_encoding is the way bzr finds out what actual encoding the rest of the system is using. On windows for instance, letting someone override this to a different value from what GetACP returns can corrupt the environment block and crash the process. On posix, you'd get unicode decode errors trying to interpret localised error messages, and pass incompatible bytestrings down into libraries and on to other processes.

For your original problem, of wanting to enter a utf-8 commit message in an editor when LANG=C, I think we just need better logic in that particular area. There's little reason not to just try utf-8 first, catch the error, and then try the locale encoding. I don't like that kind of heuristic much, but it will do the right thing more often than the current code.

review: Disapprove

« Back to merge proposal