My apologies if this is a simple question - I'm familiar with text encodings, but not so much with the Python/Plex ecosystem.
I'm preparing my plugin for localization - and what better way to do that than to translate it into your native language? In casu: Danish, which has its own, weird, non-ASCII characters "æ", "ø" and "å"
In my da.json translation file, I put in the following translation:
"CHILDREN" : "Børn"
This makes Plex/Python/... very unhappy:
File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/objects.py", line 71, in _set_attribute
el.set(convert_name(name), value)
File "lxml.etree.pyx", line 699, in lxml.etree._Element.set (src/lxml/lxml.etree.c:34531)
File "apihelpers.pxi", line 563, in lxml.etree._setAttributeValue (src/lxml/lxml.etree.c:15781)
File "apihelpers.pxi", line 1366, in lxml.etree._utf8 (src/lxml/lxml.etree.c:22211)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
So I try Unicode:
"CHILDREN" : u'Børn'
Doesn't work either:
2015-01-29 12:50:20,713 (7f8af7fff700) : WARNING (data:179) - Error decoding with simplejson, using demjson instead (this will cause a performance hit) - Expecting value: line 7 column 35 (char 285) 2015-01-29 12:50:20,715 (7f8af7fff700) : ERROR (localization:456) - Exception when trying to load da strings
So I try an HTML entity reference:
"CHILDREN" : "Børn"
At least this doesn't cause any error messages - but the translated text shows up exactly as written, i.e. in the UI (iPad) I see "Børn", not "Børn".
Garh! How do I get these weird characters in there?