Recipe 25 | Using Unicode Normalization for Comparison |
Task
Your QA opens the following issues for you:
In some cases, the search for cities returns lower-than-expected results. I can’t exactly pin the issues, but it happens when non-English letters are involved.
You head over to the QA office and ask them to show you a failing example. After a search in their browser history—no funny stuff there—you come up with the following failing test:
| db := []*Tour{ |
| {"Gdańsk", "Polish Food", date(2021, 1, 1)}, |
| {"Kraków", "Pub to Pub", date(2021, 1, 2)}, |
| } |
| tours := findTours(db, "Kraków") |
| fmt.Printf("number of tours found: %d\n", len(tours)) |
PDF and Unicode | |
---|---|
Due to Unicode issues in the PDF, the file shown ... |
Get Effective Go Recipes now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.