azai91 / alfred-drive-workflow

Alfred workflow to search google drive
MIT License
224 stars 23 forks source link

Normalize query string from NFD to NFC #67

Open risou opened 4 years ago

risou commented 4 years ago

Thank you for your great product!

I got one problem using this workflow. When we search for files on Google Drive, we cannot get the result correctly if the inputted query includes sonant marks. (e.g. "が")

In my opinion, Alfred seems to treat input strings as utf-8-mac(NFD). We need to normalize input strings for filtering files correctly.

This pull request has one way of difference for normalize string. If you are good, please merge this p-r and release a new version.

Another way, we can change this workflow's first script filter as shown below. If you adopt the following change, close this p-r because it is unnecessary.

- ./google-drive.rb --filter "$1"
+ ./google-drive.rb --filter $(echo "$1" | iconv -f "UTF-8-MAC" -t "UTF-8")
risou commented 4 years ago

I notice a problem of merging this p-r.

This p-r normalizes the input query to NFC. This causes change characters that should not be changed. That is CJK compatibility ideographs change to unified ideographs.

For example, が is converted to . This is an expected conversion. (The motivation for this p-r.)

But as well, is converted to . This is an undesirable conversion.

In conclusion, I want to apply the difference in the comment above. That solution doesn't cause this problem.