Skip to content

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

@Turbo87

Description

@Turbo87
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"));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions