Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
ok the 0xc3 is in fact a unicode character. it's a capital A with e Tilda (~) above it. I have done a little bit of reading on this. and i think there is a way to get unicode support into EG for the log. but as to how much work it will be i am unsure due to how EG uses events to trigger actions. it's one thing to simply get it to display properly in the log. it's something completely different as to how to handle having eg search for an event in the tree. it' s beyond my knowledge at present. and it would also be something that would have to be done at the core level. but the broadcaster plugin can be modified to work properly simply by going into the plugin and at line 91-99 this the the current code. now this is a oversimplified way of correcting the socket close problem. and the characters may not appear properly. don't know read below.
if (not my_addr) or self.selfBroadcast:
bits = data.split(str(self.payDelim))
commandSize=len(bits)
if commandSize==1:
self.plugin.TriggerEvent(bits[0])
if commandSize==2:
self.plugin.TriggerEvent(bits[0],bits[1])
if commandSize>2:
self.plugin.TriggerEvent(bits[0],bits[1:])
# quick and dirty hack to stop the broadcaster plugin from disconnecting sockets
# due to unicode encoded data
if (not my_addr) or self.selfBroadcast:
bits = data.split(str(self.payDelim))
commandSize=len(bits)
if commandSize==1:
self.plugin.TriggerEvent(str(bits[0]))
if commandSize==2:
self.plugin.TriggerEvent(str(bits[0]), bits[1])
if commandSize>2:
self.plugin.TriggerEvent(str(bits[0]), bits[1:])
If you like the work I have been doing then feel free to
This is so weird because the message that is being received is t1.SUNRISE which is what my tablet sends to EG to start my morning alarm stuff in EG. Which works 99% of the time..... I'm not even sending a à character (Ä is nordic tho, but i'm not using that one either.....)
thanks for your fixing attempt KG, I will switch out the snippet you mentioned and see if my problem is ameliorated by that.
kgschlosser wrote:you may or may not have to change the suffix.decode('utf8') to suffix.decode('latin1')
this unicode stuff i have not really messed with. so this is a learning process for the both of us
Depends on what sent the bytes over UDP. UTF-8 makes the most sense here, but the bigger problem is that there is a typo in the suggestion (encode rather than decode). Simply document that anything broadcasting to EG needs to send UTF-8 encoded bytes, which will be decoded on reception. That puts the onus on the sender to comply. Shouldn't need try-except at all, other than to log an error if the sender does not comply.
And need to do the payload as well as the event name. I covered all but when the payload length is more than 2.
thanks David for catching that dumbass messup.. LOL
happens with me all the time tho.
yeah this is for nordic characters. so it could be latin1 that's why i stated that..
but his error is for only one hex so the utf8 should work. it's when ya get 2 hex characters but the error message in the traceback doesn't show the message. and i am not sure if on a unicode error if it shows all characters out of ordinal range or just the first one it comes across.. i am thinking it's probably the first one it comes across
i am running into a similar problem with a plugin i am working on but if i encode the string with utf8 it builds the xml tree but won't convert the xml tree into a string. and if i convert it using str() i get an error elsewhere. so not exactly sure how to handle that kind of issue because i have to iterate through the whole thing..... unless maybe if i use isinstance to check and see if it's not a basestring and if not then convert it and if it's unicode then to encode it. i dunno i will have to mess with it
If you like the work I have been doing then feel free to