Open TishSerg opened 6 years ago
pdu.py
, lines 299-307:
# Encode message text and set data coding scheme based on text contents
try:
encodedTextLength = len(encodeGsm7(text))
except ValueError:
# Cannot encode text using GSM-7; use UCS2 instead
encodedTextLength = len(text)
alphabet = 0x08 # UCS2
else:
alphabet = 0x00 # GSM-7
Sorry. I've misclicked.
Could you dump produced PDUs?
After line 919 of modem.py add:
self.log.error("Debug PDUs.---\nMessage: {0}\n---\n---PDU: ---\n".format(text))
for p in pdus:
self.log.error(str(codecs.encode(p.data, 'hex_codec')).upper())
self.log.error("---")
Sorry, at this time I don't have that hardware. When I will be able to do this, I'll let you know.
@TishSerg Any update on this? :-)
Oops. I've completely forgotten about it. Now, I'm not working with hardware anymore, so cannot reproduce this :( Sorry.
Anyone up and running any modem with this library? Could you try to send the text/code from the first post (above) in SMS?
@TishSerg it could be a generic issue, let's see. Thanks for the prompt reply. :-)
Hello! I trying to send long SMSs. When I send long SMS (eg. consisting of 7 PDUs) using GSM-7 coding it works fine. But when I send long SMS using UCS2 coding (even consisting of 2 PDUs) - on receiving side text is corrupted. It seems like an encoding problem, isn't it?
Source text (I trying to send this):
This text will be encoded using UCS2 due to "\t" symbols near the beginning. I programmatically limit this text to fit it into 1 then 2 PDUs. Results on the picture: First (correctly coded) message - source text was limited to 1 PDU (UCS2). Second (incorrectly coded) message - same source text was limited to 2 PDUs (UCS2).
The Modem I use is SIM800C.