I am using bulk sms service, https://www.bulksms.com,
I am not able to send arabic message due to encoding.
message = بريستيج
vals = {
'username': gateway.login,
'password': gateway.password,
'message': message,
'msisdn': mobile,
}
urllib.urlencode(vals)
req = urllib2.Request(url, params)
f = urllib2.urlopen(req)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)
I fixed this issue with: message.encode('utf8')
but when message send it replace char with ??? ??????
char
Thanks for help
Presuming you're using BulkSMS.com's older EAPI, for a Unicode SMS you would have to add
dca=16bitto the URL, and encode your message body in hex - see How do I send Unicode (16-bit) SMSs? in the FAQ.It would be far easier to use the newer JSON API, which will do roughly what you expected in the first place, with no extra effort: