Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Roger Light
Exactly. Note that this will fail on python3 though, because "unicode" doesn't exist. On Mon, Feb 11, 2013 at 9:32 PM, Alexander Bolotnov wrote: > got you, so the following in publish(): > > if isinstance(payload, str) == True or isinstance(payload, bytearray) == > True: > local_paylo

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Alexander Bolotnov
got you, so the following in publish(): if isinstance(payload, str) == True or isinstance(payload, bytearray) == True: local_payload = payload should actually be something like if payload and type(payload) in (str, unicode, bytearray): local_payload = payload I guess thanks,

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Roger Light
Hi > I'm now using a dirty walkaround: > > def send_message(self, topic, message): > if type(message) == unicode: > message = str(message).encode('string_escape') > result, some_number = Client.mc.publish(topic, message) mosquitto.py does actually support p

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Alexander Bolotnov
Hi, I'm using 2.7 and it's a unicode string: u'привет' - I'm actually getting them from my gtalk_daemon type(message) will return unicode I'm now using a dirty walkaround: def send_message(self, topic, message): if type(message) == unicode: message = str(message).enc

Re: [Mosquitto-users] unicode strings

2013-02-11 Thread Roger Light
Hi, I'm not near a computer right now, but can you tell me what version of python you are using and how you are creating the string? Thanks, Roger On Feb 11, 2013 6:48 PM, "Alexander Bolotnov" wrote: > While trying to send unicode strings to mosquitto with python client I get > the following:

[Mosquitto-users] unicode strings

2013-02-11 Thread Alexander Bolotnov
While trying to send unicode strings to mosquitto with python client I get the following: TypeError: payload must be a string, bytearray, int, float or None. how do I then submit unicode data? Sasha Bolotnov www.bolotnov.info -- Mailing list: https://launchpad.net/~mosquitto-users Post to :