equal
deleted
inserted
replaced
334 |
334 |
335 if isinstance(s, localstr): |
335 if isinstance(s, localstr): |
336 return s._utf8 |
336 return s._utf8 |
337 |
337 |
338 try: |
338 try: |
339 if s.decode('utf-8'): |
339 s.decode('utf-8') |
340 return s |
340 return s |
341 except UnicodeDecodeError: |
341 except UnicodeDecodeError: |
342 # surrogate-encode any characters that don't round-trip |
342 # surrogate-encode any characters that don't round-trip |
343 s2 = s.decode('utf-8', 'ignore').encode('utf-8') |
343 s2 = s.decode('utf-8', 'ignore').encode('utf-8') |
344 r = "" |
344 r = "" |
345 pos = 0 |
345 pos = 0 |