Skip to content

Commit

Permalink
fix unicode issues with urllib.urlencode()
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgalbu committed Jan 10, 2016
1 parent 37991e6 commit 85c09ff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,16 @@ def addListItem(name, url, mode, iconimage, isfolder=False, usefullurl=False, cu
'mode': str(mode),
'name': name
}
params.update(customparams) #merge params with customparams
params = urllib.urlencode(params) #urlencode the params

#merge params with customparams
params.update(customparams)

#Fix problems of encoding with urlencode and utf8 chars
for key, value in params.iteritems():
params[key] = unicode(value).encode('utf-8')

#urlencode the params
params = urllib.urlencode(params)

generated_url = "%s?%s" % (sys.argv[0], params)
liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
Expand Down

0 comments on commit 85c09ff

Please sign in to comment.