Commit f7dfa5e4 authored by Tom Niget's avatar Tom Niget

Fix find_indices to support UTF-8 characters

parent 12e8b9a3
import sys import sys
import math import math
def g(): def gàé():
return 1,2,3 return 1,2,3
if __name__ == "__main__": if __name__ == "__main__":
if True: if True:
a, b, c = g() a, b = gàé() # abc
\ No newline at end of file \ No newline at end of file
...@@ -148,8 +148,8 @@ def find_indices(s, indices: list[int]) -> list[int]: ...@@ -148,8 +148,8 @@ def find_indices(s, indices: list[int]) -> list[int]:
except StopIteration: except StopIteration:
break break
j += len(s[i].encode("utf-8"))
i += 1 i += 1
j += 1
assert len(results) == len(indices), (results, indices, s) assert len(results) == len(indices), (results, indices, s)
return sorted(list(results)) return sorted(list(results))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment