Improve gclient Python 3 compatibility

This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
diff --git a/fix_encoding.py b/fix_encoding.py
index 34f6cb8..faa7c7c 100644
--- a/fix_encoding.py
+++ b/fix_encoding.py
@@ -95,8 +95,8 @@
   argc = c_int(0)
   argv_unicode = CommandLineToArgvW(GetCommandLineW(), byref(argc))
   argv = [
-      argv_unicode[i].encode(encoding, 'replace')
-      for i in xrange(0, argc.value)]
+      argv_unicode[i].encode(encoding, 'replace') for i in range(0, argc.value)
+  ]
 
   if not hasattr(sys, 'frozen'):
     # If this is an executable produced by py2exe or bbfreeze, then it
@@ -107,7 +107,7 @@
     # Also skip option arguments to the Python interpreter.
     while len(argv) > 0:
       arg = argv[0]
-      if not arg.startswith(u'-') or arg == u'-':
+      if not arg.startswith(b'-') or arg == b'-':
         break
       argv = argv[1:]
       if arg == u'-m':