Skip to content

Add support for Data8Bit encoding - #44

Open
ah9142 wants to merge 1 commit into
xlab:masterfrom
ah9142:support_8bit_codec
Open

Add support for Data8Bit encoding#44
ah9142 wants to merge 1 commit into
xlab:masterfrom
ah9142:support_8bit_codec

Conversation

@ah9142

@ah9142 ah9142 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Add support for Data8Bit encoding

Data8Bit encoding is specified in TS 23.038, Section 4.
It is used to transmit strings of user defined 8-bit data.

Data8Bit encoding is specified in TS 23.038, Section 4.
It is used to transmit strings of user defined 8-bit
data.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.66%. Comparing base (379970a) to head (53c87ff).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
sms/sms.go 71.42% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   36.13%   37.66%   +1.52%     
==========================================
  Files          18       21       +3     
  Lines        1605     1524      -81     
==========================================
- Hits          580      574       -6     
+ Misses        940      858      -82     
- Partials       85       92       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xlab

xlab commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Hello, there is some feedback from Codex:

• Basic unheaded DCS 0x04 messages round-trip correctly, but 8-bit messages containing a user-data header return header bytes as part of the payload.

Review comment:

  • [P2] Exclude the user-data header from 8-bit payloads — sms/sms.go:370-370
    When an 8-bit SMS has TP-UDHI set, such as a concatenated or port-addressed binary message, dataLen includes both the UDH and payload, so this assignment exposes the header bytes at the start of Message.Text. The deliver/status decoders already parse that prefix into
    UserDataHeader, and the UCS2 path skips it; validate UDHL+1 and slice from that offset so callers receive only the binary payload.

@xlab

xlab commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Please confirm if this is real or not, I am assuming you have the necessary hardware..

@ah9142

ah9142 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

I need to test and look more into this.
However, just by looking at the code it seems that codex is right about the 8-bit codec.
Also, it seems that the same issue is present in the gsm 7-bit codec implementation.

I.e.
UCS2 implementation -> Handles user data header and does not include it in Text
7bit gsm and 8bit binary implementation -> Ignore user data header and return the full payload in Text.

When I implemented the 8-bit code, I just looked at the 7-bit gsm codec implementation and missed this completely.
I will confirm this and probably fix for both 8-bit and 7-bit codecs if applicable.

EDIT:
Actually, depending on the caller they might want either the full userdata headers + the text or just the text. So, probably having both available in one for or another is the correct way to go. Then if the user equipment wants to attempt parsing the User-Data headers (for example to assemble a multi-part SMS or load one of those polyfonic MIDI files embedded in the SMS) then it should be free to do so. While if it provides just the baseline functionality, it should be possible to skip the headers and display the text to the user.

But as I already wrote. This requires some more thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants