No non-English characters are searched.
you6878 opened this issue · comments
When using with latin chars like ç
or ã
its does not work too.
The Go code will search for 어
:
>> go run cmd/search/main.go "어"
{
"items": [
{
"title": "ㅍㅏᄋ ᅵ 어 works",
"subtitle": "#tech",
"arg": "B6AA2EED-C378-4759-B7F7-B2618A90AC13-51237-00037885D409A198",
"valid": true
}
]
}
But it appears that Alfred won't send queries that contain it. I suspect Alfred's Script Filter code can only handle ASCII inputs and has an error that blanks out the query once it receives non-ASCII Unicode.
@drgrib
I had trouble processing non-ASCII input in my Alfred workflows too, and it turns out it is due to UTF-8 normalization. It is fully possible to search for UTF-8 input as long as you perform NFC normalization on it first.
This is really tricky to notice as the strings will look identical when you print them, but comparisons won't yield the expected result. For example, if I pass "björn" as the Alfred query:
utf8.GlyphsInString(os.Args[1]) => 6, because one extra is added due to the ¨ being recorded as a separate glyph
utf8.GlyphsInString("björn") => 5
os.Args[1] == "björn" => false, because the normalization is different
Here's quick fix in Go:
import (
"golang.org/x/text/unicode/norm"
)
query := norm.NFC.String(os.Args[1])