[PATCH 2 of 6] Determine default locale encoding and stdio encoding on start-up

Matt Mackall mpm at selenic.com
Mon Nov 13 00:10:05 UTC 2006


On Mon, Nov 13, 2006 at 12:49:25AM +0700, Andrey wrote:
> @@ -48,6 +48,15 @@ class ui(object):
>              self.ucdata = None
>              self.readconfig(util.rcpath())
>              self.updateopts(verbose, debug, quiet, interactive)
> +
> +            self.encodings = {}
> +            self.encodings['default'] = (self.config("ui", "encoding")
> +                                        or locale.getpreferredencoding())
> +            # windows may use different encoding for stdio
> +            self.encodings['stdio'] = (self.config("ui", "stdio_encoding")
> +                                      or self.config("ui", "encoding")
> +                                      or sys.stdout.encoding or sys.stdin.encoding
> +                                      or self.encodings['default'])

Again, should be in util.py. Don't know if it makes sense to bother
with two different config options. When is that useful?

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list