message.decode() incorrect detects encoding
- Dominant language
- JavaScript
- Stars
- 435
- Forks
- 194
- PR merge metrics
- No merged PRs in 30d
Description
defs.filters.message.decode() function detects encoding simply `encoding = this.data_coding & 0x0F;`
But according documentation this is incorrect when data_coding carriers more information than only encoding [ftp://www.3gpp.org/tsg_t/TSG_T/TSGT_04/Docs/PDFs/TP-99127.pdf](url)
What about to change line `encoding = this.data_coding & 0x0F;` to
```
var encoding = 0;
if (this.data_coding <= 0x0E) {
encoding = this.data_coding & 0x0F;
}
// Non-MWI Mode 1
else if ((this.data_coding & 0xF0) == 0xF0) {
encoding = (this.data_coding & 0x04) ? consts.ENCODING.BINARY : consts.ENCODING.ASCII; // grab bit 2
}
// Non-MWI Mode 0
else if ((this.data_coding & 0xC0) == 0x00) {
encoding = (this.data_coding & 0x0C) >> 2; // grab bit 3,2
if (encoding == 0) {
encoding = consts.ENCODING.ASCII;
} else if (encoding == 1) {
encoding = consts.ENCODING.BINARY;
} else if (encoding == 2) {
encoding = consts.ENCODING.UCS2;
} else { // 3 is reserved
//encoding = consts.ENCODING.ASCII;
}
}
// MWI Mode
else if ((this.data_coding & 0xC0) == 0xC0) {
encoding = ((this.data_coding & 0xE0) == 0xE0) ? consts.ENCODING.UCS2 : consts.ENCODING.ASCII;
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.