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

Chapter 12.5 should mention that search with to_lowercase is not correct with Unicode #2148

Closed
malaire opened this issue Nov 11, 2019 · 0 comments · Fixed by #2364
Closed

Comments

@malaire
Copy link

malaire commented Nov 11, 2019

The search_case_insensitive example in chapter 12.5 should mention that this solution of using to_lowercase for case insensitive matching is not correct for Unicode and is only used to make the example simple.

For example this test fails when using to_lowercase:

    #[test]
    fn case_insensitive_unicode() {
        let query = "weiß";
        let contents = "WEISS";

        assert_eq!(
            vec!["WEISS"],
            search_case_insensitive(query, contents)
        );
    }

ps. Correct solution would be to use case folding, but I don't know if that is available in Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants