qotto / smspdudecoder Goto Github PK
View Code? Open in Web Editor NEWPython SMS PDU Decoder
License: MIT License
Python SMS PDU Decoder
License: MIT License
Hi,
I've found a situation when after encoding and decoding text is not equal to source text. Example
text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà'
print(codec.decode(codec.encode(text)) == text)
False
print(codec.decode(codec.encode(text)))
ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà@
we can see that after encoding/decoding an extra symbol "@" is added.
Hi,
Trying to run tests on a freshly cloned smspdu on python-3.6, I'm getting this error:
py36 runtests: PYTHONHASHSEED='807310402'
py36 runtests: commands[0] | pip install -r requirements.txt
Requirement already satisfied: bitstring==3.1.5 in ./.tox/py36/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (3.1.5)
Requirement already satisfied: pytz==2017.3 in ./.tox/py36/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (2017.3)
Requirement already satisfied: six==1.11.0 in ./.tox/py36/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (1.11.0)
py36 runtests: commands[1] | mypy smspdu
smspdu/elements.py:205: error: Argument 1 to "get" of "Mapping" has incompatible type "Optional[str]"; expected "str"
smspdu/elements.py:206: error: Argument 1 to "get" of "Mapping" has incompatible type "Optional[str]"; expected "str"
smspdu/fields.py:195: error: Value of type "Optional[Dict[Any, Any]]" is not indexable
smspdu/fields.py:199: error: Value of type "Optional[Dict[Any, Any]]" is not indexable
smspdu/fields.py:201: error: Value of type "Optional[Dict[Any, Any]]" is not indexable
smspdu/fields.py:208: error: Value of type "Optional[Dict[Any, Any]]" is not indexable
ERROR: InvocationError: 'xxxxxx/smspdu/.tox/py36/bin/mypy smspdu'
_____________________________________ summary _____________________________________
ERROR: py36: commands failed
really lacking
Hi,
I've tried with python3.10 but you can see that Out[4 ] is pretty strange as result, any idea on how to fix this?
In [1]: from smspdudecoder.codecs import GSM, UCS2
In [2]: GSM.decode(GSM.encode('1234567', with_padding=True), strip_padding=True)
Out[2]: '1234567'
In [4]: GSM.decode('07919333851805420406D0D4641300002220720171424087C7B29B9E6697416376BAECA69759206AB2099A068D45D0B52804D1E561D00D744EBFE5EE34081
...: E9ECFCBF23F280C8287CFE176D94D7F83C66F37A8EE068DC3EEB7BB0C22A741F3373B', strip_padding=True)
Out[4]: 'ì"NÆSΔF$BòΣ@MΞYÇ@@ò£".¡8B@æ<,v&Of.ùΞfN.v&/f$"MlèΞ\r4,è:-Λè"Ψåù:¥:NüΠwNù$åßÉ/Πàì\nù$å>Ån.v&àùΞüvù*wùΞÅvüv.ù"NùΞàf'
I've tried out also python-messaging that output an expected readable result of Out[4]:
In [1]: from messaging.sms import SmsDeliver
In [2]: pdutext='07919333851805420406D0D4641300002220720171424087C7B29B9E6697416376BAECA69759206AB2099A068D45D0B52804D1E561D00D744EBFE5EE34081E9ECFCBF23F280C8287CFE176D
...: 94D7F83C66F37A8EE068DC3EEB7BB0C22A741F3373B'
In [3]: x=SmsDeliver(pdutext)
In [4]: x.text
Out[4]: 'Gentile cliente, TIM SAFE WEB tra 7 giorni passerà a pagamento con un canone di sol'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.