}
If I continue to fix your code, at the end is identical to the mine.
Better if you go to Problem 6) Subproblem A), you need to write one separate function…
At the start try to convert just the string
07912180958739F1040B917120069876F000009140503223218A21D4F29C0E6A97E7F3F0B90CA2BF41412A68F86EB7C36E32885A9ED3CB72
ignoring all previous code, is useless at this step…
Very strange. I check the result of your script and mine and they have identical results in my opinion. Could you show what exactly is missing in my version? What symbols?
I have not yet begun to decode the body of the SMS itself, that is, such an excerpt as you showed. But I can even translate it a little with my hands. For example, the phone is SCA 12085978931, and the sender is 17026089670, TP-DCS is a 7-bit compressed encoding, the possible date of sending is 2019/04/05 23:32:12 A 8 time zone (probably China). Naturally, I’m not an expert and I’m not very good at decoding and I can make mistakes in this data, but I just started doing it.
I can select all these parts of the SMS using the script, including the SMS text itself, and at this stage I cannot yet decode the SMS text itself. The rest are no problems so far.
Example:
using my code
07912180958739F1040B917120069876F000009140503223218A21D4F29C0E6A97E7F3F0B90CA2BF41412A68F86EB7C36E32885A9ED3CB72
usin your (unaltered or clean, no difference) code
07912180958739F1040B917120069876F000009140503223218A21D4F29C0E6A97E7F3F0B90CA2BF41412A68F86EB7C36E32885A9ED3CB7
do not notice the mising 2 at the end?
( 8A is GMT -7 (28 times -15) as explained before, is on USA , not China… )
You are really right. This is my carelessness. I corrected the starting point in one place, because I began to use “\r\n” instead of “\n” and forgot in another. This is how it works right
Unfortunately, I have not yet had time to see what my conceptual errors are, which you noticed in the redone version. I hope to be able to take a look later tonight.
I think I went down the same path that you suggested looking for my mistake.
Managed to watch. Here you are absolutely right. So the code will be more correct and shorter. I should have guessed it myself, even though I did a draft.
I read somewhere that the “find” command is the most expensive and energy intensive. In my version, it is used only once.
I’ve updated my script by changing the variable names to be more consistent,
I’ve reformatted the code for clarity,
optimized the internal operations to execute as few instructions as possible
and make everything easier to understand how it works.
Do you have more examples explaining how to decipher some of the meanings? I can’t figure out how to deal with the sender number and SMS type (SMS-DELIVER,SMS-STATUS REPORT,SMS-SUBMIT REPORT,RESERVED)
Or, for example, what is the type of SMS if it is encrypted as 44 or 60 or 40?
Your code is really good, I didn’t argue with that. But my task was first of all to learn different ways of working with arrays using the example of working with SMS. And I always keep your option in front of my eyes. If I understand correctly, then with the correction of my mistake about cutting off the last SMS character, there are no special comments on my version?
If so, then it remains for me to deal with some of the nuances of recoding. I already know how to make an additional local function that would turn an encrypted phone into a normal one. Still need to figure out how to work with the letter number. And some other things.
(44? 60? 40? in those case is better if the number is > of 9 specify if are decimal numbers or hexadecimal, etc. but I do not know what correspondence is…)
It’s not entirely clear how I’m supposed to figure out which encoding to choose for my language. Here, it seems that the message is written in English, but it can only be translated by your UCS2toUTF8 function into some other numbers and percent signs, and the second function says that there is an error. Although the text in the SMS is written in English.
Here is the SMS text: “C8329BFD065DDF72363904”
Before that, it says that some kind of 7-bit encoding is used, but I don’t understand what that means.
SMS from your example also does not display in the terminal in normal English or something else. Only numbers and percent signs
Before it can be used on my program for encode/decode GSM-7 the data must be converted from 7 bit PDU to 8 bit hex…
RouterOS can display only 7 bit ascii standard characters, not GSM-7 UCS-2 or UTF-8
The %encode is for send the message using fetch to twitter, whatsapp, etc.
Even from utf8 terminal over ssh? I’ve seen characters correctly displayed from scripts which are not in 7 bit ascii when connecting over ssh, still cli input is ascii always…