Code Monkey home page Code Monkey logo

Comments (3)

shokuie avatar shokuie commented on August 19, 2024

I'm not sure if you changed the library or not but decode does not take two arguments. Anyway, the backslash should be encoded to 0x9B17 as GSM7 is a septet based (7 bit) encoding. Here is how this happens:

0x1b (H) = 0001 1011 (B), 0x2f (H) = 0010 1111 (B)

A: 0001 1011 --> to 7 bit (drop bit #7) --> 001 1011 --> move bit# 0 of second octet to bit# 7 of the first octet --> 1001 1011  

B: 0010 1111 --> shift 1 bit to the right (already move bit# 7) --> 0001 0111 

C:  Output --> [A, B] = 1001 1011 (B), 0001 0111 (B) -> 0x9B (H), 0x17 (H)

from gsm7.

polsumeet3666 avatar polsumeet3666 commented on August 19, 2024

hi @shokuie ,
Thanks for quick response.
I agree with above encoding logic completely.

I am using GSM7 encoding to send SMS messages using SMPP protocol.
as per docs, GSM-7 is the standard alphabet for SMS messages, written up in the standard GSM 03.38.
The GSM 7-bit default alphabet consists of 128 characters totally and each character is represented by 7 bits. 10 extra characters are defined in the GSM 7-bit default alphabet extension table and they have to be represented through an escape mechanism using the escape character (0x1B). The 10 extra characters are:

Form feed

Caret / circumflex

Left curly bracket

Right curly bracket

Backslash

Left square bracket

Tilde

Right square bracket

Vertical bar

Euro sign

The codes of the 10 characters above begin with 0x1B (i.e. the escape character), which indicates they are escaped sequences. For example, the code of the Backslash sign is 0x1B2F.

Hence I reported the issue.

from gsm7.

shokuie avatar shokuie commented on August 19, 2024

Closing this issue as everything looks correct and as expected. Feel free to reopen it if you find some issues.

from gsm7.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.