Skip to content

Commit 9a8d046

Browse files
authored
1 parent 5861da1 commit 9a8d046

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

router/src/server.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ fn encoding_to_tokens(encoding: &tokenizers::Encoding, input: &str) -> Vec<Simpl
7474
.iter()
7575
.zip(offsets)
7676
.map(|(&id, &(start, stop))| {
77-
let text = input
78-
.chars()
79-
.skip(start)
80-
.take(stop - start)
81-
.collect::<String>();
77+
let text: Vec<u8> = input.bytes().skip(start).take(stop - start).collect();
78+
let text: String = String::from_utf8_lossy(&text).to_string();
8279
SimpleToken {
8380
id,
8481
text,

0 commit comments

Comments
 (0)