Comments (4)
@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])
from alfred-bear.
When using with latin chars like ç
or ã
its does not work too.
from alfred-bear.
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.
from alfred-bear.
from alfred-bear.
Related Issues (20)
- Feature request: open/create notes in app by default HOT 5
- Error when running on Monterey 12.3 HOT 2
- Bear 2.0/Beta support request HOT 17
- Searching without the hotkey HOT 3
- `bsearch` and `bs` disappear after pressing space or select HOT 6
- Search for Tag doesn't work when there is a space in the Tag name HOT 15
- Alfred Bear workflow may not work with Bear 2.x HOT 10
- Search failing with Bear2 update HOT 3
- Error when searching HOT 1
- Create a new blank note HOT 2
- Bug when creating ToC, if the title is a link, it doesn't go to that title HOT 4
- Error: "cmd/search/search: Bad CPU type in executable" HOT 2
- Feature request: Allow to search archived notes as well HOT 3
- Insert wiki-links instead of linking to id HOT 9
- Pressing SPACE after typing BS makes alfred-bear Workflow disappear HOT 3
- Infinite wait state HOT 3
- Native Apple Silicon Support without Rosetta HOT 4
- Please add the github sponsorship. HOT 8
- License? HOT 3
- Get the link to that note via a hotkey (shift enter, option enter, etc.) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alfred-bear.