Skip to content

Commit

Permalink
Assume UTF-8 for regex matches
Browse files Browse the repository at this point in the history
This code wouldn't have worked on any other encoding anyway
  • Loading branch information
dralley committed Aug 29, 2022
1 parent 94fd296 commit fd55c87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/custom_entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(Event::DocType(ref e)) => {
for cap in entity_re.captures_iter(e.as_bytes()) {
custom_entities.insert(
reader.decoder().decode(&cap[1])?.into_owned(),
reader.decoder().decode(&cap[2])?.into_owned(),
String::from_utf8(cap[1].to_owned())?,
String::from_utf8(cap[2].to_owned())?,
);
}
}
Expand Down

0 comments on commit fd55c87

Please sign in to comment.