Expand description
GSM 7-bit default alphabet, extension table and national language tables (3GPP TS 23.038 §6.2.1 and Annex A), plus septet packing (§6.1.2.1).
Septets are handled unpacked (one u8 per septet, values 0..=0x7F) by
encode/decode and bit-packed by pack/unpack.
National tables covered: Turkish (locking + single shift), Spanish (single shift; 23.038 defines no Spanish locking table), Portuguese (locking + single shift).
Structs§
- Tables
- Locking shift table plus single shift table used for one message.
Enums§
- Language
- National language identifier (23.038 §6.2.1.2.4), limited to the tables this module carries.
Constants§
- ESC
- Escape to the single shift (extension) table.
Functions§
- choose_
tables - Cheapest table pair able to encode
text: the default tables if they work, otherwise the combination of the allowedlockingandsingleshift tables (the default table is always allowed) with the fewest septets plus UDH cost (3 octets per national IE).Noneif nothing fits. - decode
- Unpacked septets → text (23.038 §6.2.1.1). Unknown escape sequences show the
locking-table character at that index;
ESC ESCand a trailing loneESCshow a space. Bit 7 of every input byte is ignored. - encode
- Text → unpacked septets.
Err(c)names the first character with no mapping. - encode_
char - Septets for one character:
[code]or[ESC, code].Noneif the character is in neither table. - is_
encodable - pack
- Pack septets into octets, LSB first, after
fill_bitszero bits (0..=7; larger values are taken modulo 8). Used withfill_bits> 0 after a UDH (23.040 §9.2.3.24). - septet_
len - Septet count of
text, orNoneif it is not encodable withtables. - septets_
in - Number of septets that fit in
octetsafterfill_bitsbits. - unpack
- Unpack up to
countseptets starting afterfill_bitsbits. Returns fewer when the input runs out; never panics.