faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
384 stars 302 forks source link

UC2 SMS not encoded correctly #49

Open obana1990 opened 9 years ago

obana1990 commented 9 years ago

Hi,

First of all thanks for all the hardwork, it's very useful. I was able to connect and send sms no problem. Then I tried to send unicode message like chinese and arabic text, it sends out successfully but the content delivered at the destination wasn't the original message instead it's just a bunch of weird symbols.

I'm running the script "sendsms.py" under tools directory. I'm using wavecom modem for your information.

Thanks in advance.

sah-anshu commented 9 years ago

Please try sending in PDU mode.

obana1990 commented 9 years ago

I am sending on PDU mode. modem.textMode = False ? On Apr 17, 2015 2:21 AM, "Sah, Anshu" notifications@github.com wrote:

Please try sending in PDU mode.

— Reply to this email directly or view it on GitHub https://github.com/faucamp/python-gsmmodem/issues/49#issuecomment-93950828 .

sah-anshu commented 9 years ago

Hi Correct Statement is below: modem.smsTextMode = False

Ref: https://github.com/faucamp/python-gsmmodem/blob/master/examples/sms_handler_demo.py

obana1990 commented 9 years ago

Hi, thank you so much. I will try it out after I got home tonight! On Apr 17, 2015 9:16 AM, "Sah, Anshu" notifications@github.com wrote:

Hi Correct Statement is below: modem.smsTextMode = False

Ref: https://github.com/faucamp/python-gsmmodem/blob/master/examples/sms_handler_demo.py

— Reply to this email directly or view it on GitHub https://github.com/faucamp/python-gsmmodem/issues/49#issuecomment-94019247 .

obana1990 commented 9 years ago

Hi,

I double check my code and yes I did modem.smsTextMode = False but it still giving wrong result. Some of the basic GSM characters like £ also not sending out properly.

I also run sms_handler_demo with my port configuration like below but getting same result like my scripts does:

def main(): print('Initializing modem...')

Uncomment the following line to see what the modem is doing:

logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
modem = GsmModem(PORT, BAUDRATE, smsReceivedCallbackFunc=handleSms)
modem.smsTextMode = False 
modem.connect(PIN)
modem.sendSms("7036253126","哈哈")
modem.close();
MaplerStory commented 9 years ago

You should use modem.sendSms("7036253126",u"哈哈") thus, if you use PDU mode, then you should send an unicode text