Searching for Été should at least find the book named Été. That is a modest ambition for a search box.
Dnote’s new server fix removes a mismatch between Go’s Unicode lowercasing and SQLite’s default ASCII-only conversion. The old path lowercased the search text in Go and used LOWER(label) in SQL. The new path preserves the search text and uses label LIKE ?, retaining literal wildcard escaping. [1]
Here is a small Python/SQLite reconstruction of that query behavior. It needs no Dnote installation, server, account or external package. I use Python’s lowercasing for the same accented example; this is not the Go test suite.
Run the search boundary
Save this as demo.py and run python3 demo.py. The assertions check the failing shape, the narrow repair, ASCII case matching, literal wildcards and a separately defined Unicode key.
import sqlite3 import unicodedata db = sqlite3.connect(":memory:") db.execute("CREATE TABLE books(label TEXT NOT NULL)") db.executemany("INSERT INTO books VALUES (?)", [(s,) for s in ("Été", "js", "100%", "1000", "a_b", "axb")]) def pattern(text): return "%" + text.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_") + "%" old_sql = r"SELECT label FROM books WHERE LOWER(label) LIKE ? ESCAPE '\' ORDER BY label" new_sql = r"SELECT label FROM books WHERE label LIKE ? ESCAPE '\' ORDER BY label" def find(sql, term): return [r[0] for r in db.execute(sql, (pattern(term),))] old = find(old_sql, "Été".lower()) exact = find(new_sql, "Été") different_case = find(new_sql, "été") assert old == [] and exact == ["Été"] and different_case == [] assert find(new_sql, "JS") == ["js"] assert find(new_sql, "0%") == ["100%"] assert find(new_sql, "a_") == ["a_b"] print("old query:", old) print("preserved query:", exact) print("different accented case:", different_case) def casekey(text): return unicodedata.normalize("NFC", text.casefold()) db.create_function("casekey", 1, casekey, deterministic=True) caseless_sql = "SELECT label FROM books WHERE instr(casekey(label), casekey(?)) > 0" matches = [r[0] for r in db.execute(caseless_sql, ("E\u0301TE\u0301",))] assert matches == ["Été"] assert casekey("Straße") == casekey("STRASSE") print("explicit Unicode key:", matches) old query: [] preserved query: ['Été'] different accented case: [] explicit Unicode key: ['Été'] The first result is the bug in miniature. Python turns the search term into été; SQLite leaves the capital accented character in the stored label unchanged. The two sides have been “lowercased” under different rules. The label and pattern no longer match.
Original character trace of the executed query fixture. Image by Shivam Dwivedi.
SQLite documents both boundaries: its built-in lower() converts ASCII letters, and default LIKE folds ASCII case while treating non-ASCII case distinctions literally. [2][3] That is why JS still finds js, while été does not find Été in the preserved query.
Repair the regression before naming the feature
Dnote’s patch adds the accented label to its server test and checks that searching with that same spelling returns it. It also keeps tests for literal percent and underscore characters. [1] Those are useful separate obligations.
Binding a parameter protects the SQL statement’s structure. It does not make % or _ ordinary characters inside a LIKE pattern. In this fixture, an unescaped underscore would also match the middle character in axb. Escaping it makes the intended a_b search literal.
The repaired query does not establish full Unicode caseless search. Calling the patch “Unicode support” without that qualification would promise a broader behavior than its code supplies.
Choose the equality rule explicitly
The final part of the program chooses a different product rule: normalize a casefolded string to NFC, then perform a literal substring search with instr. Python documents casefolding for caseless matching; normalization handles equivalent composed and decomposed character sequences. [4][5] The decomposed accented query in the code therefore finds the stored composed label.
This is an illustrative application-defined function, not a Dnote change. It deliberately avoids LIKE wildcard semantics. It also does not remove accents or implement every language’s locale-specific expectations. Casefolding Straße and STRASSE to the same key is a documented behavior; whether your product wants that equality is a design decision.
For a real indexed search, I would specify that rule before choosing how to store or index the key. The function-wrapped substring query above demonstrates correctness on the fixture; it makes no query-plan or large-database performance claim. A successful exact-text repair and a complete search policy are different deliverables.
References
Sung and Dnote contributors, book-name fix and regression tests.
SQLite, built-in lower function.
SQLite, LIKE and ESCAPE semantics.
Python documentation, str.casefold.
Python documentation, Unicode normalization.
Asset credits
Original explanatory figure and example, CC BY 4.0. Credit: Shivam Dwivedi. No third-party image assets.
AI disclosure
AI was used to draft the article.

