alfredapp / google-drive-workflow

Alfred Workflow for Google Drive
BSD 3-Clause "New" or "Revised" License
170 stars 8 forks source link

normalize unicode string #5

Closed smasato closed 2 years ago

smasato commented 2 years ago

Correct when entering a Japanese query. Some Japanese characters are represented by two Unicode characters. Therefore, non-normalized queries will not hit the DB search. Normalization makes it a Unicode single character. Then it will hit the search.

irb(main):009:0> "プ".length
=> 2
irb(main):010:0> "プ".length
=> 1
irb(main):011:0> "プ".unicode_normalize.length // character on the first line
=> 1
vitorgalvao commented 2 years ago

Thank you. I’ll be releasing a new version shortly.

Made a small modification and normalised the string before splitting on spaces, so it only needs to happen once.