Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: byte index 12 is not a char boundary #51

Closed
Turbo87 opened this issue Oct 19, 2021 · 0 comments · Fixed by #52
Closed

panic: byte index 12 is not a char boundary #51

Turbo87 opened this issue Oct 19, 2021 · 0 comments · Fixed by #52

Comments

@Turbo87
Copy link
Contributor

Turbo87 commented Oct 19, 2021

panic: byte index 12 is not a char boundary; it is inside '打' (bytes 10..13) of `crates/实打实打算/d's'd`
  File "panicking.rs", line 515, in rust_begin_unwind
  ?, in route_recognizer::nfa::Thread::extract
  ?, in route_recognizer::nfa::NFA<T>::process
  ?, in route_recognizer::Router<T>::recognize
  ?, in conduit_router::RouteBuilder::call
...
(32 additional frame(s) were not displayed)

this can be reproduced by:

#[test]
fn test_chinese() {
    let mut router = Router::new();
    router.add("/crates/:foo/:bar", "Hello".to_string());

    let m = router.recognize("/crates/实打实打算/d's'd").unwrap();
    assert_eq!(m.handler().as_str(), "Hello");
    assert_eq!(m.params().find("foo"), Some("实打实打算"));
    assert_eq!(m.params().find("bar"), Some("d's'd"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant