From 9f6657727b9f1639970beb6052837a4ab6c33299 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 9 Jun 2013 11:20:02 +1200 Subject: [PATCH] Make UTF environment detection more robust. Fixes #125 --- mitmproxy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mitmproxy b/mitmproxy index 2d773c02e..f8b424440 100755 --- a/mitmproxy +++ b/mitmproxy @@ -62,12 +62,14 @@ if __name__ == '__main__': opts.debug = options.debug opts.palette = options.palette - if "utf" not in os.environ.get("LANG", "").lower(): + spec = "" + for i in ["LANG", "LC_CTYPE", "LC_ALL"]: + spec += os.environ.get(i, "").lower() + if "utf" not in spec: print >> sys.stderr, "Error: mitmproxy requires a UTF console environment." print >> sys.stderr, "Set your LANG enviroment variable to something like en_US.UTF-8" sys.exit(1) - m = console.ConsoleMaster(server, opts) try: m.run()