hgext/convert/common.py
changeset 38312 79dd61a4554f
parent 37622 bfdd20d22a86
child 39425 2dd9519b8c8a
equal deleted inserted replaced
38311:47f5454a30ed 38312:79dd61a4554f
   212 
   212 
   213     def recode(self, s, encoding=None):
   213     def recode(self, s, encoding=None):
   214         if not encoding:
   214         if not encoding:
   215             encoding = self.encoding or 'utf-8'
   215             encoding = self.encoding or 'utf-8'
   216 
   216 
   217         if isinstance(s, unicode):
   217         if isinstance(s, pycompat.unicode):
   218             return s.encode("utf-8")
   218             return s.encode("utf-8")
   219         try:
   219         try:
   220             return s.decode(pycompat.sysstr(encoding)).encode("utf-8")
   220             return s.decode(pycompat.sysstr(encoding)).encode("utf-8")
   221         except UnicodeError:
   221         except UnicodeError:
   222             try:
   222             try: