unicode --> latin-1 for weather wunderground alerts to fix special chars... #2495

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@phil65
Member
phil65 commented Mar 24, 2013

... (ä,ö,ü etc)

is there a reason that this was never fixed? does it break something else when converting to latin-1? seems to work here without problems...

EDIT: I see, i get an "&NBSP" now at the end.

should i fix that with some string parsing?
or do you expect them to make the fixes on their API side?

@phil65
Owner
phil65 commented on b325fee Mar 24, 2013

ok, will close then. was just wondering since it is a default feature and totally looks unreadable in german for example.
thx for heads-up.

@phil65 phil65 closed this Mar 24, 2013
@ghost
ghost commented Mar 24, 2013

the. unescaped html as well ronie?

@phil65
Member
phil65 commented Mar 24, 2013

yeah read that. i just thaught it would be nice to get it fixed on xbmc side since it´s broken for a long long time and i doubt that they´ll ever fix that.

@ronie
Member
ronie commented Mar 24, 2013

@phil65 i don't see how that could be fixed xbmc side, but if you've got some ideas, i'm all ears :-)
i did try your patch, but it didn't make any difference at my end (tested on both linux & windows)

@cptspiff yup, the api provides a completely garbled alerts message.

@phil65
Member
phil65 commented Mar 24, 2013

hmm at least on my end it fixed the errors for ä,ö, and ü which are often used in German. (it introduced some "&NBSP" (--> space) at the end though, but if that´s all we could remove that manually in python of course)

@ronie
Member
ronie commented Mar 24, 2013

this is what i get (with or without your patch):
http://i687.photobucket.com/albums/vv237/roniez/tmp/alerts.jpg?t=1364158958

looks pretty messed up to me, but again, if it's fixable at our end, i'm all for it.

@phil65
Member
phil65 commented Mar 24, 2013

strange, perhaps i was wrong. tested properly again and my patch doesn´t change anythin when using confluence.
in nox (displayed in a textbox control) the characters appear correctly...

@ronie
Member
ronie commented Mar 25, 2013

heh figured it out why it works in one skin but not the other:
line 523 & 524 also need the fix.

this seems to work ok:
foo.encode("latin-1").decode("utf-8").rstrip('&nbsp)')

if you could give it a spin:
http://ronie.googlecode.com/files/weather.wunderground-1.0.11.zip

@phil65
Member
phil65 commented Mar 25, 2013

yep, workin here.
anything wrong with fixing it this way @cptspiff ?

@ghost
ghost commented Mar 25, 2013

yes. still wrong. ronie; you decode into the python encoding. you manipulate, then you encode in the encoding you want to return (utf8)

@ghost
ghost commented Mar 25, 2013

ehrr too early read it backwards. that is fine indeed. though you should still move the strip in principle.

@ronie
Member
ronie commented Mar 25, 2013

k, will move the strip between the en- and decoding.

i've posted a test version on the forum so users can test this stuff
before i push it to the addon repo.

@phil65 phil65 deleted the phil65:wunderground-encoding branch Oct 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment