diff options
Diffstat (limited to 'src/pdu_decode.c')
-rw-r--r-- | src/pdu_decode.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pdu_decode.c b/src/pdu_decode.c index 140fd14..934aef5 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -309,6 +309,31 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe pdu->user_data[i] = '\0'; } + //Only for 7-bit character sets + if ((pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) || + (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_DEFAULT)) { + int read = 0; + int store = 0; + + log_debug("Converting from GSM character set to IRA"); + for (read = 0; read < pdu->user_data_len; read++) { + if (pdu->user_data[read] == 0x1B) { + //Character from the extended set using the escape char (27) + read++; + log_debug("GSM before: 0x1B%02X | IRA after: 0x%02X", pdu->user_data[read], strExtendedTable[pdu->user_data[read]]); + pdu->user_data[store] = strExtendedTable[pdu->user_data[read]]; + } + else { + log_debug("GSM before: 0x%02X | IRA after: 0x%02X", pdu->user_data[read], strGSMTable[pdu->user_data[read]]); + pdu->user_data[store] = strGSMTable[pdu->user_data[read]]; + } + store++; + } + //Update lengths + pdu->user_data_len -= read - store; + pdu_str -= (read - store) * HEX_BYTE_LEN; + } + return pdu_str - begin; } |