Fix locale.getlocale() exception.

Reapply r79006 with fixes for ubuntu 10.4.

The only change is in fix_default_encoding() to trap an exception
locale.getlocale() may throw.

[email protected]
BUG=none
TEST=unit test

Review URL: http://codereview.chromium.org/6721029

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79144 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index 4b9d94c..c33973d 100644
--- a/gclient.py
+++ b/gclient.py
@@ -64,6 +64,7 @@
 
 import breakpad  # pylint: disable=W0611
 
+import fix_encoding
 import gclient_scm
 import gclient_utils
 from third_party.repo.progress import Progress
@@ -1266,6 +1267,7 @@
 
 
 if '__main__' == __name__:
+  fix_encoding.fix_encoding()
   sys.exit(Main(sys.argv[1:]))
 
 # vim: ts=2:sw=2:tw=80:et: