String encoding - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: String encoding (/showthread.php?tid=11495) |
- Phunck - 2005-04-18 this is more a not to other people running into the same kind of bugs as i have. they can be quite hard to find. xbmc's python is very sensitive to string encodings. here's a recent experience when i built a cache into ooba. i had these lines: Quote:localfile=cachefolder+'f'+digest+'.'+ext and it chrashed (refused to open the file) whenever ext was not an empty string (e.g. localfile="faa6abcb928ad22070e69cf30591a5432.gif"). note this only happened on the xbox, not in the emu. i managed to get it to work by doing this: Quote:localfile=cachefolder+'f'+digest+'.'+ext.encode('iso-8859-1') note, ext comes from a regexp that has been applied to a url: Quote:extre=re.compile('\w?(jpg|jpeg|gif|png)\w?',re.ignorecase) #be very flexible with extension. and the url was read from xml with minidom. i suppose it is when it is read from xml that something happens to the encoding. i've also had similar problems with controllists when i was trying to add items that were encoded wrongly (utf-8). |