dingmaotu / mql-zmq

ZMQ binding for the MQL language (both 32bit MT4 and 64bit MT5)
Apache License 2.0
544 stars 298 forks source link

Getting "unicode not allowed, use send_string" error when implementing with python 3(.7) #20

Closed doobedoobedoo closed 6 years ago

doobedoobedoo commented 6 years ago

Hello,

The code works very well when used with python 2.7 (thanks so much again!!!). However, for efficiency matters, I am trying to switch to python 3.7 but get the error "unicode not allowed, use send_string", would you have an idea on how I could fix this issue.

Thanks a lot for your time!

EDIT: Found the solution --> you have to encode the unicode string in python using unicode_string.encode(encoding), I used "utf-8" for encoding

dingmaotu commented 6 years ago

Yes, you should encode all strings to UTF-8 when sent over the network.