mercurial/encoding.py
changeset 33811 dabe1f11ae3a
parent 33761 f5fc54e7e467
child 33839 7d5bc0e5b88f
equal deleted inserted replaced
33810:b3a41f4d837b 33811:dabe1f11ae3a
    76 except locale.Error:
    76 except locale.Error:
    77     encoding = 'ascii'
    77     encoding = 'ascii'
    78 encodingmode = environ.get("HGENCODINGMODE", "strict")
    78 encodingmode = environ.get("HGENCODINGMODE", "strict")
    79 fallbackencoding = 'ISO-8859-1'
    79 fallbackencoding = 'ISO-8859-1'
    80 
    80 
    81 class localstr(str):
    81 class localstr(bytes):
    82     '''This class allows strings that are unmodified to be
    82     '''This class allows strings that are unmodified to be
    83     round-tripped to the local encoding and back'''
    83     round-tripped to the local encoding and back'''
    84     def __new__(cls, u, l):
    84     def __new__(cls, u, l):
    85         s = str.__new__(cls, l)
    85         s = bytes.__new__(cls, l)
    86         s._utf8 = u
    86         s._utf8 = u
    87         return s
    87         return s
    88     def __hash__(self):
    88     def __hash__(self):
    89         return hash(self._utf8) # avoid collisions in local string space
    89         return hash(self._utf8) # avoid collisions in local string space
    90 
    90