mercurial/py3kcompat.py
changeset 21291 007d276f8c94
parent 17424 e7cfe3587ea4
child 21292 a7a9d84f5e4a
equal deleted inserted replaced
21290:74be3fb1e3b8 21291:007d276f8c94
    50         args = tuple(newargs)
    50         args = tuple(newargs)
    51     ret = format % args
    51     ret = format % args
    52     return ret.encode('utf-8', 'surrogateescape')
    52     return ret.encode('utf-8', 'surrogateescape')
    53 builtins.bytesformatter = bytesformatter
    53 builtins.bytesformatter = bytesformatter
    54 
    54 
    55 # Create bytes equivalents for os.environ values
       
    56 for key in list(os.environ.keys()):
       
    57     # UTF-8 is fine for us
       
    58     bkey = key.encode('utf-8', 'surrogateescape')
       
    59     bvalue = os.environ[key].encode('utf-8', 'surrogateescape')
       
    60     os.environ[bkey] = bvalue
       
    61 
       
    62 origord = builtins.ord
    55 origord = builtins.ord
    63 def fakeord(char):
    56 def fakeord(char):
    64     if isinstance(char, int):
    57     if isinstance(char, int):
    65         return char
    58         return char
    66     return origord(char)
    59     return origord(char)