equal
deleted
inserted
replaced
506 s.decode('utf-8') |
506 s.decode('utf-8') |
507 return s |
507 return s |
508 except UnicodeDecodeError: |
508 except UnicodeDecodeError: |
509 pass |
509 pass |
510 |
510 |
|
511 s = pycompat.bytestr(s) |
511 r = "" |
512 r = "" |
512 pos = 0 |
513 pos = 0 |
513 l = len(s) |
514 l = len(s) |
514 while pos < l: |
515 while pos < l: |
515 try: |
516 try: |
558 # We could do this with the unicode type but some Python builds |
559 # We could do this with the unicode type but some Python builds |
559 # use UTF-16 internally (issue5031) which causes non-BMP code |
560 # use UTF-16 internally (issue5031) which causes non-BMP code |
560 # points to be escaped. Instead, we use our handy getutf8char |
561 # points to be escaped. Instead, we use our handy getutf8char |
561 # helper again to walk the string without "decoding" it. |
562 # helper again to walk the string without "decoding" it. |
562 |
563 |
|
564 s = pycompat.bytestr(s) |
563 r = "" |
565 r = "" |
564 pos = 0 |
566 pos = 0 |
565 l = len(s) |
567 l = len(s) |
566 while pos < l: |
568 while pos < l: |
567 c = getutf8char(s, pos) |
569 c = getutf8char(s, pos) |