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

Issue with sending texts through modem on linux environment #65

Closed m1012290 closed 7 years ago

m1012290 commented 8 years ago

File "/usr/local/lib/python2.7/site-packages/serial/serialutil.py", line 76, in to_bytes b.append(item) # this one handles int and str for our emulation and ints for Python 3.x TypeError: an integer or string of size 1 is required

Fix this by explicitly encoding text to UTF-8 format as shown below where ever applicable - self.write(text.encode("utf-8"), timeout=15, writeTerm=chr(26))

tomchy commented 7 years ago

Hey! I've fixed this inside recently updated fork by babca@8f80ae9 and babca@09065e6 and added unit tests using UTF-8 characters :slightly_smiling_face: