Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Icons with unicode characters may be reset to DefaultShortcut.png #167

Open
ghost opened this issue Mar 12, 2016 · 2 comments
Open

Comments

@ghost
Copy link

ghost commented Mar 12, 2016

When checking for icon overrides, one of the checks is to ask Kodi if the skin has the image in question. When there is unicode in the name, this check may return False even if the image does exist.

As the problem is not readily reproducible in a consistent manner, and my time is limited at present, I'll fix this when I can get into the problem properly.

@phil65
Copy link
Collaborator

phil65 commented Mar 15, 2016

One small advice: try to make sure as early as possible that all your inner workings are using unicode.
That for example means that everything you get from the kodi API needs .decode("utf-8"), otherwise it is a str.

from __future__ import unicode_literals

might also help, it automatically prefixes all "text" with u then (--> u"text") so that they are unicode.

Was struggling a long time with this myself but finally got everything right :) I dont need any try_decode() stuff anymore anywhere in my script.

@ghost
Copy link
Author

ghost commented Mar 18, 2016

Undoubtedly good advice, and advice I've taken into account with my recent update to the library node editor. In terms of this script, doing so requires a lot of code-checking and testing to ensure that no bugs are introduced (as, at present, we're using try_decode to handle the text being or not being unicode). In general terms, if scripts need to - by par of the course - convert anything coming from Kodi to unicode, there is a definite argument that Kodi should be providing text in this format by default ;)

In terms of this specific issue, though I haven't had time to get into it properly yet - and won't for a few days yet - the underlying format of the string, and therefore how it's imported into the script, processed, and so on, doesn't initially appear to be related to the issue. When initially adding a shortcut via the context menu add-on the text is unicode and the correct icon appear; when updating the icon of another shortcut the context menu add-on text is still unicode, but the correct icon doesn't appear - suggesting that, whilst the issue is unicode (as it only appears to affect paths with unicode), it's not how the text is encoded/decoded at issue (though it may well be related to the unicode workarounds that we have in place...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant