{
    "mode": "perldoc",
    "parameter": "Encode::GSM0338",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Encode%3A%3AGSM0338/json",
    "generated": "2026-05-30T19:08:55Z",
    "synopsis": "use Encode qw/encode decode/;\n$gsm0338 = encode(\"gsm0338\", $unicode); # loads Encode::GSM0338 implicitly\n$unicode = decode(\"gsm0338\", $gsm0338); # ditto",
    "sections": {
        "NAME": {
            "content": "Encode::GSM0338 -- ETSI GSM 03.38 Encoding\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Encode qw/encode decode/;\n$gsm0338 = encode(\"gsm0338\", $unicode); # loads Encode::GSM0338 implicitly\n$unicode = decode(\"gsm0338\", $gsm0338); # ditto\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "GSM0338 is for GSM handsets. Though it shares alphanumerals with ASCII,\ncontrol character ranges and other parts are mapped very differently,\nmainly to store Greek characters. There are also escape sequences\n(starting with 0x1B) to cover e.g. the Euro sign.\n\nThis was once handled by Encode::Bytes but because of all those unusual\nspecifications, Encode 2.20 has relocated the support to this module.\n\nThis module implements only *GSM 7 bit Default Alphabet* and *GSM 7 bit\ndefault alphabet extension table* according to standard 3GPP TS 23.038\nversion 16. Therefore *National Language Single Shift* and *National\nLanguage Locking Shift* are not implemented nor supported.\n",
            "subsections": [
                {
                    "name": "Septets",
                    "content": "This modules operates with octets (like any other Encode module) and not\nwith packed septets (unlike other GSM standards). Therefore for\nprocessing binary SMS or parts of GSM TPDU payload (3GPP TS 23.040) it\nis needed to do conversion between octets and packed septets. For this\npurpose perl's \"pack\" and \"unpack\" functions may be useful:\n\n$bytes = substr(pack('(b*)*', unpack '(A7)*', unpack 'b*', $septets), 0, $numofseptets);\n$unicode = decode('GSM0338', $bytes);\n\n$bytes = encode('GSM0338', $unicode);\n$septets = pack 'b*', join '', map { substr $, 0, 7 } unpack '(A8)*', unpack 'b*', $bytes;\n$numofseptets = length $bytes;\n\nPlease note that for correct decoding of packed septets it is required\nto know number of septets packed in binary buffer as binary buffer is\nalways padded with zero bits and 7 zero bits represents character \"@\".\nNumber of septets is also stored in TPDU payload when dealing with 3GPP\nTS 23.040.\n"
                }
            ]
        },
        "BUGS": {
            "content": "Encode::GSM0338 2.7 and older versions (part of Encode 3.06) incorrectly\nhandled zero bytes (character \"@\"). This was fixed in Encode::GSM0338\nversion 2.8 (part of Encode 3.07).\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "3GPP TS 23.038 <https://www.3gpp.org/dynareport/23038.htm>\n\nETSI TS 123 038 V16.0.0 (2020-07)\n<https://www.etsi.org/deliver/etsits/123000123099/123038/16.00.0060/t\ns123038v160000p.pdf>\n\nEncode\n",
            "subsections": []
        }
    },
    "summary": "Encode::GSM0338 -- ETSI GSM 03.38 Encoding",
    "flags": [],
    "examples": [],
    "see_also": []
}