plyer
plyer copied to clipboard
Wrong SMS example, app crashes when your try to use unicode symbols
Hello,
I think there is some error in sms example ( https://github.com/kivy/plyer/tree/master/examples/sms ).
Your should use
smstext = unicode(self.sms_message.strip(codecs.BOM_UTF8), 'utf-8') sms.send(recipient=self.sms_recipient, message=smstext)
instead of
sms.send(recipient=self.sms_recipient, message=self.sms_message)
For some languages your need to use utf16.
https://docs.python.org/2/howto/unicode.html
Unicode character U+FEFF is used as a byte-order mark (BOM), and is often written as the first character of a file in order to assist with autodetection of the file’s byte ordering. Some encodings, such as UTF-16, expect a BOM to be present at the start of a file; when such an encoding is used, the BOM will be automatically written as the first character and will be silently dropped when the file is read. There are variants of these encodings, such as ‘utf-16-le’ and ‘utf-16-be’ for little-endian and big-endian encodings, that specify one particular byte ordering and don’t skip the BOM.
Note: Python 2.7 support is no longer required. Call to unicode()
may need to be reconsidered.