-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect 7bit-encode #21
Comments
Hello @AdamSmid, 👋 Thank you! |
Hi @AdamSmid I also had this issue. Just a long text without any special char, gives a wrong pdu part, after decode, a char is missing at the end. @KillerJulian Reproduce:
Returns two parts
If you send this to a modem (or just decompile with parse function) You will see
The letter The code The issue also exists in the new major version. |
Extra note: the fix The pdu string is not valid if we send it to the modem. I could not find out why. |
Im using this fix in production modem (16 sim cards) since 2019 and everything works. |
I'm also not sure how best to solve the problem. Any other suggestions? |
It is not a solution to the problem but rather a workaround. By inserting a Unicode zero-width space into the message, you can trigger a different encoding process. const submit = new Submit(number, message += "\u200B"); |
I'm getting CMS error 21 when using this fix, which means the message is being rejected by the operator. If I decode the pdu throught this site https://smspdu.benjaminerhart.com/ I see user data length is 161. Not sure why is working on your modem |
can you please share your full code so that I can test this. Thanks |
If the 7 bit encoding causes so many problems (see other issues), does it make sense to refactor with cleaner and simpler code? Maybe there is a library that solves this problem? I have to admit, I'm not very familiar with the subject so far. 😅 |
I invested some more time, but could not solve the problem. As I said before, I only have a limited insight into this library. Perhaps you have another solution or know someone who could solve this problem? Feel free to commit on my branch Regards Julian |
@lipflip Please provide a full code example |
Im using serialport-gsm together with node-pdu.
And I found that SMS length from my database queue is not equal with sms recivied on the phone.
I did some test, and in my country we are using some special characters "ěěščřřžýáí".
So if the SMS used these special characters node-pdu switch to use ALPHABET_UCS2 and it was OK.
But with simply sms without special characters with simple ASCII chars the function Helper.encode7Bit starts to return wrong length of text. Basically it was missing char at the end of each SMS PDU part.
I fixed it with increase length of return string
file: node-pdu/PDU/Helper.js
function: Helper.encode7Bit = function(text, alignBits)
return [len+1, ret]; };
The text was updated successfully, but these errors were encountered: