1Encode::GSM0338(3) User Contributed Perl Documentation Encode::GSM0338(3)
2
3
4
6 Encode::GSM0338 -- ETSI GSM 03.38 Encoding
7
9 use Encode qw/encode decode/;
10 $gsm0338 = encode("gsm0338", $unicode); # loads Encode::GSM0338 implicitly
11 $unicode = decode("gsm0338", $gsm0338); # ditto
12
14 GSM0338 is for GSM handsets. Though it shares alphanumerals with ASCII,
15 control character ranges and other parts are mapped very differently,
16 mainly to store Greek characters. There are also escape sequences
17 (starting with 0x1B) to cover e.g. the Euro sign.
18
19 This was once handled by Encode::Bytes but because of all those unusual
20 specifications, Encode 2.20 has relocated the support to this module.
21
22 This module implements only GSM 7 bit Default Alphabet and GSM 7 bit
23 default alphabet extension table according to standard 3GPP TS 23.038
24 version 16. Therefore National Language Single Shift and National
25 Language Locking Shift are not implemented nor supported.
26
27 Septets
28 This modules operates with octets (like any other Encode module) and
29 not with packed septets (unlike other GSM standards). Therefore for
30 processing binary SMS or parts of GSM TPDU payload (3GPP TS 23.040) it
31 is needed to do conversion between octets and packed septets. For this
32 purpose perl's "pack" and "unpack" functions may be useful:
33
34 $bytes = substr(pack('(b*)*', unpack '(A7)*', unpack 'b*', $septets), 0, $num_of_septets);
35 $unicode = decode('GSM0338', $bytes);
36
37 $bytes = encode('GSM0338', $unicode);
38 $septets = pack 'b*', join '', map { substr $_, 0, 7 } unpack '(A8)*', unpack 'b*', $bytes;
39 $num_of_septets = length $bytes;
40
41 Please note that for correct decoding of packed septets it is required
42 to know number of septets packed in binary buffer as binary buffer is
43 always padded with zero bits and 7 zero bits represents character "@".
44 Number of septets is also stored in TPDU payload when dealing with 3GPP
45 TS 23.040.
46
48 Encode::GSM0338 2.7 and older versions (part of Encode 3.06)
49 incorrectly handled zero bytes (character "@"). This was fixed in
50 Encode::GSM0338 version 2.8 (part of Encode 3.07).
51
53 3GPP TS 23.038 <https://www.3gpp.org/dynareport/23038.htm>
54
55 ETSI TS 123 038 V16.0.0 (2020-07)
56 <https://www.etsi.org/deliver/etsi_ts/123000_123099/123038/16.00.00_60/ts_123038v160000p.pdf>
57
58 Encode
59
60
61
62perl v5.32.0 2020-12-02 Encode::GSM0338(3)