nate-parrott / Flashlight

The missing Spotlight plugin system
http://flashlight.nateparrott.com
Other
5.39k stars 411 forks source link

some unicode encode issues #262

Open johan-sun opened 9 years ago

johan-sun commented 9 years ago

there are some case the unicode will convert into str automatically. str.join(unicode) str + unicode str % unicode

if the string contain some foreign language like chinese, it will crash (baidu ,youdao etc.) . so we need speciafy the charset like unicode('utf-8')

qq20150112-2 2x

qq20150112-3 2x

After encode some unicode to str with charset utf-8, everything is ok.

qq20150112-5 2x qq20150112-6 2x

I suggest that pre-encode the argument to str with charset "utf-8" an then invoke the function results in plugin.py . Because most people forgot that the first argument of results can be a dict of unicode strings.

If need, I can manually fix the character encode problem of those bundles.

nate-parrott commented 9 years ago

Yep, unicode is a recurring issue.

Plugin input used to be pre-encoded to utf-8, and there were still issues like this, where attempting to do string processing when mixing unicode and non-unicode strings would cause crashes. I think the best approach is just to use unicode strings everywhere, fixing crashes when they come up.

So yeah, manually fixing the encoding problems seems like the way to go. Feel free to do that yourself, or you can list the plugins that are crashing and I'll take a look at them.

Thanks for the report!

mtunique commented 9 years ago

I have manually fixed the encoding problems in some plugins. #274