equal
deleted
inserted
replaced
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: |