Skip to content

Commit 0b76628

Browse files
committed
Assume UTF-8 for regex matches
This code wouldn't have worked on any other encoding anyway
1 parent 7cb166f commit 0b76628

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/custom_entities.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3535
Ok(Event::DocType(ref e)) => {
3636
for cap in entity_re.captures_iter(e.as_bytes()) {
3737
custom_entities.insert(
38-
reader.decoder().decode(&cap[1])?.into_owned(),
39-
reader.decoder().decode(&cap[2])?.into_owned(),
38+
String::from_utf8(cap[1].to_owned())?,
39+
String::from_utf8(cap[2].to_owned())?,
4040
);
4141
}
4242
}

0 commit comments

Comments
 (0)