Closed elgatito closed 3 years ago
Thanks for reporting. I assume this is when using UpNext with local media, on Kodi v18 or older?
@dagwieers Oh, sorry, had to give those details.
Yes, it's Kodi 18, so Python2 there. It's not a local media, a video plugin, which sets correct infolabels, but they are according to Kodi language, so tvshowtitle is unicode in this case.
@elgatito Interesting, which video plugin is this? Because we compare unicode vs unicode, even on Python 2 (unicode_literals). So I am suspecting that the add-on is not in fact sending us unicode. It is easy to verify if I can look at their code.
@dagwieers The code of creating a resolved item is here: https://github.com/elgatito/plugin.video.elementum/blob/master/resources/site-packages/elementum/navigation.py#L166
Infolabels come from a backend server, just parsed by python and passed to Kodi via setResolvedUrl
. Kodi shows everything in correct Unicode.
@elgatito Right, but on Python 2.7 strings are not unicode strings. So you need to do the below (and probably fix code elsewhere) to use unicode literals by default (as you would on Python 3).
from __future__ import absolute_import, division, unicode_literals
And explicitly convert from and to unicode strings for anything that does not use unicode strings (Kodi v18 and older API does not). https://python-future.org/unicode_literals.html
My advice is to use unicode_literals so your code behaves identically on Python 2 and Python 3, and be careful on the edges (where you interface with other software like Kodi). We have two functions to_unicode()
and from_unicode()
which do the required conversion in a way that works correctly on both Python 2 and Python 3.
Once Kodi v17 (Krypton) and v18 (Leia) are used much less than today we can drop support and remove those calls from the codebase and things will work out as before.
@dagwieers I will close this issue. I get no error so far, after adding unicode encoding to json. Thanks
Hello,
I encountered an issue with UpNext when the tv show title has Unicode chars, and tvshowid is empty:
That is an error coming from
api.showtitle_to_id
.