2013-10-01, 15:09
Hi, a user of my addon reported a problem using the Spanish character in the show name Carnivàle.
BTW, I posted this in the JSON-RPC sub-forum, and was told that JSON uses UTF8, and the database is UTF8. So that leaves me trying to figure out why python thinks the string is ascii. EDIT- which it assumes by default
Here is the query:
This is the output:
Whenever I try and use 'file' I get this error:
jurrabi's post helped a little. And my current fix is:
But I get an error when I try to encode to UTF-8, and besides, this doesnt look like a robust solution.
Can anyone advise on a better solution?
BTW, I posted this in the JSON-RPC sub-forum, and was told that JSON uses UTF8, and the database is UTF8. So that leaves me trying to figure out why python thinks the string is ascii. EDIT- which it assumes by default
Here is the query:
Code:
episode_request = {"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"properties": ["season","episode","runtime", "resume","playcount", "tvshowid", "lastplayed", "file"]}, "id": "allTVEpisodes"}
This is the output:
Code:
[{u'tvshowid': 1, u'episode': 5, u'resume': {u'position': 0, u'total': 0}, u'season': 1, u'lastplayed': u'2013-10-01 15:25:54', u'episodeid': 1, u'label': u'1x05. Babylon', u'file': u'C:\\TV Shows\\Carniv\xe0le\\Season1\\Carniv\xe0le.S01E05.mkv', u'playcount': 0, u'runtime': 3600}]
Whenever I try and use 'file' I get this error:
Code:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 115: ordinal not in range(128)
jurrabi's post helped a little. And my current fix is:
Code:
def bodge(name):
try:
str(name).lower
n = name
except:
n = name.encode('latin')
return n
But I get an error when I try to encode to UTF-8, and besides, this doesnt look like a robust solution.
Can anyone advise on a better solution?