The User Data Length (UDL) indicated the length of the user data. If the encoding
scheme is GSM 7 bit, than the User Data Length is the number of septets. If the User
Data Header is present, the UDL is the sum of the total number of septets in the User
Data Header and the total number of septets in the User data.
If the encoding scheme is 8 bit or UCS2 then the User Data Length is the number of
octets in the User Data field. If a User Data Header is present the UDL is the sum of the
total number of Octets in the User Data Header and the total number of Octets in the
User data.
The User Data is the actual message being sent. When sent in GMS 7-bit format the
message can be up to 160 characters. When sent in 8-bit encoding the message length
is 140 characters. When sent in UCS2 the message length is 70 characters.
To be able to send 160 characters in GSM 7 bit into the 140 available octets, you need
to pack the 7 bit data into the 8 bit octet. For example, the word Hello in 7 bits would be:
Character 7- bit format
H 1001000 (a7,a6,a5,a4,a3,a2,a1)
e 1100101 (b7,b6,b5,b4,b3,b2,b1)
l 1101100 (c7,c6,c5,c4,c3,c2,c1)
l 1101100 (d7,d6,d5,d4,d3,d2,d1)
o 1101111 (e7,e6,e5,e4,e3,e2,e1)
Pack the 7 bits into 8 bits as follows:
Octet Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Value
1
b1
1
a7
1
a6
0
a5
0
a4
1
a3
0
a2
0
a1
0
C8
2
c2
0
c1
0
b7
1
b6
1
b5
0
b4
0
b3
1
b2
0
32
3
d3
1
d2
0
d1
0
c7
1
c6
1
c5
0
c4
1
c3
1
9B
4
e4
1
e3
1
e2
1
e1
1
d7
1
d6
1
d5
0
d4
1
FD
33