|
GSM 3.38中定义的pdu格式编码, 其中7bit的部分不光要处理常见的ascii编码, 还要处理一些欧洲字符, 这些字符不在常规的127个ascii字符中, 所以需要如下映射表做一个映射, 另有部分字符与在ascii中的位置不一致, 所以千万要注意. 网上不少山寨代码都忽略协议. 想当然的实现了所谓的pdu编码格式. 忧郁中.
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
0
|
0x00
|
COMMERCIAL AT
|
@
|
64
|
0x40
|
1
|
0x01
|
POUND SIGN
|
£
|
163
|
0xA3
|
2
|
0x02
|
DOLLAR SIGN
|
$
|
36
|
0x24
|
3
|
0x03
|
YEN SIGN
|
¥
|
165
|
0xA5
|
4
|
0x04
|
LATIN SMALL LETTER E WITH GRAVE
|
È
|
232
|
0xE8
|
5
|
0x05
|
LATIN SMALL LETTER E WITH ACUTE
|
É
|
233
|
0xE9
|
6
|
0x06
|
LATIN SMALL LETTER U WITH GRAVE
|
Ù
|
249
|
0xF9
|
7
|
0x07
|
LATIN SMALL LETTER I WITH GRAVE
|
Ì
|
236
|
0xEC
|
8
|
0x08
|
LATIN SMALL LETTER O WITH GRAVE
|
Ò
|
242
|
0xF2
|
9
|
0x09
|
LATIN CAPITAL LETTER C WITH CEDILLA
|
Ç
|
199
|
0xC7
|
10
|
0x0A
|
LINE FEED
|
|
10
|
0x0A
|
11
|
0x0B
|
LATIN CAPITAL LETTER O WITH STROKE
|
Ø
|
216
|
0xD8
|
12
|
0x0C
|
LATIN SMALL LETTER O WITH STROKE
|
ø
|
248
|
0xF8
|
13
|
0x0D
|
CARRIAGE RETURN
|
|
13
|
0x0D
|
14
|
0x0E
|
LATIN CAPITAL LETTER A WITH RING ABOVE
|
Å
|
197
|
0xC5
|
15
|
0x0F
|
LATIN SMALL LETTER A WITH RING ABOVE
|
å
|
229
|
0xE5
|
2. 16----31
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
16
|
0x10
|
GREEK CAPITAL LETTER DELTA
|
∆
|
916
|
0x0394
|
17
|
0x11
|
LOW LINE
|
_
|
95
|
0x5F
|
18
|
0x12
|
GREEK CAPITAL LETTER PHI
|
Φ
|
934
|
0x03A6
|
19
|
0x13
|
GREEK CAPITAL LETTER GAMMA
|
Γ
|
915
|
0x0393
|
20
|
0x14
|
GREEK CAPITAL LETTER LAMBDA Λ
|
Λ
|
923
|
0x039B
|
21
|
0x15
|
GREEK CAPITAL LETTER OMEGA
|
Ω
|
937
|
0x03A9
|
22
|
0x16
|
GREEK CAPITAL LETTER PI
|
Π
|
928
|
0x03A0
|
23
|
0x17
|
GREEK CAPITAL LETTER PSI
|
Ψ
|
936
|
0x03A8
|
24
|
0x18
|
GREEK CAPITAL LETTER SIGMA
|
Σ
|
931
|
0x03A3
|
25
|
0x19
|
GREEK CAPITAL LETTER THETA
|
Θ
|
920
|
0x0398
|
26
|
0x1A
|
GREEK CAPITAL LETTER XI
|
Ξ
|
926
|
0x039E
|
27
|
0x1B
|
ESCAPE TO EXTENSION TABLE
|
ESC
|
|
0x1B
|
27 10
|
0x1B 0A
|
FORM FEED
|
|
12
|
0x0C
|
27 20
|
0x1B 14
|
CIRCUMFLEX ACCENT
|
^
|
94
|
0x5E
|
27 40
|
0x1B 28
|
LEFT CURLY BRACKET
|
{
|
123
|
0x7B
|
27 41
|
0x1B 29
|
RIGHT CURLY BRACKET
|
}
|
125
|
0x7D
|
27 47
|
0x1B 2F
|
REVERSE SOLIDUS (BACKSLASH)
|
\
|
92
|
0x5C
|
27 60
|
0x1B 3C
|
LEFT SQUARE BRACKET
|
[
|
91
|
0x5B
|
27 61
|
0x1B 3D
|
TILDE
|
~
|
126
|
0x7E
|
27 62
|
0x1B 3E
|
RIGHT SQUARE BRACKET
|
]
|
93
|
0x5D
|
27 64
|
0x1B 40
|
VERTICAL BAR
|
|
|
124
|
0x7C
|
27 101
|
0x1B 65
|
EURO SIGN
|
€
|
164(ISO-8859-15)
8364 (ANSI)
|
|
28
|
0x1C
|
LATIN CAPITAL LETTER AE
|
Æ
|
198
|
0xC6
|
29
|
0x1D
|
LATIN SMALL LETTER AE
|
æ
|
230
|
0xE5
|
30
|
0x1E
|
LATIN SMALL LETTER SHARP S (German)
|
ß
|
223
|
0xDF
|
31
|
0x1F
|
LATIN CAPITAL LETTER E WITH ACUTE
|
É
|
201
|
0xA9
|
3. 32----47
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
32
|
0x20
|
SPACE
|
|
32
|
0x20
|
33
|
0x21
|
EXCLAMATION MARK
|
!
|
33
|
0x21
|
34
|
0x22
|
QUOTATION MARK
|
"
|
34
|
0x22
|
35
|
0x23
|
NUMBER SIGN
|
#
|
35
|
0x23
|
36
|
0x24
|
CURRENCY SIGN
|
¤
|
164 (ISO-8859-1)
|
0xA4
|
37
|
0x25
|
PERCENT SIGN
|
%
|
37
|
0x25
|
38
|
0x26
|
AMPERSAND
|
&
|
38
|
0x26
|
39
|
0x27
|
APOSTROPHE
|
'
|
39
|
0x27
|
40
|
0x28
|
LEFT PARENTHESIS
|
(
|
40
|
0x28
|
41
|
0x29
|
RIGHT PARENTHESIS
|
)
|
41
|
0x29
|
42
|
0x2A
|
ASTERISK
|
*
|
42
|
0x2A
|
43
|
0x2B
|
PLUS SIGN
|
+
|
43
|
0x2B
|
44
|
0x2C
|
COMMA
|
,
|
44
|
0x2C
|
45
|
0x2D
|
HYPHEN-MINUS
|
-
|
45
|
0x2D
|
46
|
0x2E
|
FULL STOP
|
.
|
46
|
0x2E
|
47
|
0x2F
|
SOLIDUS (SLASH)
|
/
|
47
|
0x2F
|
4. 48----63
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
48
|
0x30
|
DIGIT ZERO
|
0
|
48
|
0x30
|
49
|
0x31
|
DIGIT ONE
|
1
|
49
|
0x31
|
50
|
0x32
|
DIGIT TWO
|
2
|
50
|
0x32
|
51
|
0x33
|
DIGIT THREE
|
3
|
51
|
0x33
|
52
|
0x34
|
DIGIT FOUR
|
4
|
52
|
0x34
|
53
|
0x35
|
DIGIT FIVE
|
5
|
53
|
0x35
|
54
|
0x36
|
DIGIT SIX
|
6
|
54
|
0x36
|
55
|
0x37
|
DIGIT SEVEN
|
7
|
55
|
0x37
|
56
|
0x38
|
DIGIT EIGHT
|
8
|
56
|
0x38
|
57
|
0x39
|
DIGIT NINE
|
9
|
57
|
0x39
|
58
|
0x3A
|
COLON
|
:
|
58
|
0x3A
|
59
|
0x3B
|
SEMICOLON
|
;
|
59
|
0x3B
|
60
|
0x3C
|
LESS-THAN SIGN
|
<
|
60
|
0x3C
|
61
|
0x3D
|
EQUALS SIGN
|
=
|
61
|
0x3D
|
62
|
0x3E
|
GREATER-THAN SIGN
|
>
|
62
|
0x3E
|
63
|
0x3F
|
QUESTION MARK
|
?
|
63
|
0x3F
|
5. 64----79
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
64
|
0x40
|
INVERTED EXCLAMATION MARK
|
¡
|
161
|
0xA1
|
65
|
0x41
|
LATIN CAPITAL LETTER A
|
A
|
65
|
0x41
|
66
|
0x42
|
LATIN CAPITAL LETTER B
|
B
|
66
|
0x42
|
67
|
0x43
|
LATIN CAPITAL LETTER C
|
C
|
67
|
0x43
|
68
|
0x44
|
LATIN CAPITAL LETTER D
|
D
|
68
|
0x44
|
69
|
0x45
|
LATIN CAPITAL LETTER E
|
E
|
69
|
0x45
|
70
|
0x46
|
LATIN CAPITAL LETTER F
|
F
|
70
|
0x46
|
71
|
0x47
|
LATIN CAPITAL LETTER G
|
G
|
71
|
0x47
|
72
|
0x48
|
LATIN CAPITAL LETTER H
|
H
|
72
|
0x48
|
73
|
0x49
|
LATIN CAPITAL LETTER I
|
I
|
73
|
0x49
|
74
|
0x4A
|
LATIN CAPITAL LETTER J
|
J
|
74
|
0x4A
|
75
|
0x4B
|
LATIN CAPITAL LETTER K
|
K
|
75
|
0x4B
|
76
|
0x4C
|
LATIN CAPITAL LETTER L
|
L
|
76
|
0x4C
|
77
|
0x4D
|
LATIN CAPITAL LETTER M
|
M
|
77
|
0x4D
|
78
|
0x4E
|
LATIN CAPITAL LETTER N
|
N
|
78
|
0x4E
|
79
|
0x4F
|
LATIN CAPITAL LETTER O
|
O
|
79
|
0x4F
|
6. 80----95
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
80
|
0x50
|
LATIN CAPITAL LETTER P
|
P
|
80
|
0x50
|
81
|
0x51
|
LATIN CAPITAL LETTER Q
|
Q
|
81
|
0x51
|
82
|
0x52
|
LATIN CAPITAL LETTER R
|
R
|
82
|
0x52
|
83
|
0x53
|
LATIN CAPITAL LETTER S
|
S
|
82
|
0x53
|
84
|
0x54
|
LATIN CAPITAL LETTER T
|
T
|
84
|
0x54
|
85
|
0x55
|
LATIN CAPITAL LETTER U
|
U
|
85
|
0x55
|
86
|
0x56
|
LATIN CAPITAL LETTER V
|
V
|
86
|
0x56
|
87
|
0x57
|
LATIN CAPITAL LETTER W
|
W
|
87
|
0x57
|
88
|
0x58
|
LATIN CAPITAL LETTER X
|
X
|
88
|
0x58
|
89
|
0x59
|
LATIN CAPITAL LETTER Y
|
Y
|
89
|
0x59
|
90
|
0x5A
|
LATIN CAPITAL LETTER Z
|
Z
|
90
|
0x5A
|
91
|
0x5B
|
LATIN CAPITAL LETTER A WITH DIAERESIS
|
Ä
|
196
|
0xC4
|
92
|
0x5C
|
LATIN CAPITAL LETTER O WITH DIAERESIS
|
Ö
|
214
|
0xD6
|
93
|
0x5D
|
LATIN CAPITAL LETTER N WITH TILDE
|
Ñ
|
209
|
0xD1
|
94
|
0x5E
|
LATIN CAPITAL LETTER U WITH DIAERESIS
|
Ü
|
220
|
0xDC
|
95
|
0x5F
|
SECTION SIGN
|
§
|
167
|
0xA7
|
7. 96---111
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
96
|
0x60
|
INVERTED QUESTION MARK
|
¿
|
191
|
0xBF
|
97
|
0x61
|
LATIN SMALL LETTER A
|
a
|
97
|
0x61
|
98
|
0x62
|
LATIN SMALL LETTER B
|
b
|
98
|
0x62
|
99
|
0x63
|
LATIN SMALL LETTER C
|
c
|
99
|
0x63
|
100
|
0x64
|
LATIN SMALL LETTER D
|
d
|
100
|
0x64
|
101
|
0x65
|
LATIN SMALL LETTER E
|
e
|
101
|
0x65
|
102
|
0x66
|
LATIN SMALL LETTER F
|
f
|
102
|
0x66
|
103
|
0x67
|
LATIN SMALL LETTER G
|
g
|
103
|
0x67
|
104
|
0x68
|
LATIN SMALL LETTER H
|
h
|
104
|
0x68
|
105
|
0x69
|
LATIN SMALL LETTER I
|
i
|
105
|
0x69
|
106
|
0x6A
|
LATIN SMALL LETTER J
|
j
|
106
|
0x6A
|
107
|
0x6B
|
LATIN SMALL LETTER K
|
k
|
107
|
0x6B
|
108
|
0x6C
|
LATIN SMALL LETTER L
|
l
|
108
|
0x6C
|
109
|
0x6D
|
LATIN SMALL LETTER M
|
m
|
109
|
0x6D
|
110
|
0x6E
|
LATIN SMALL LETTER N
|
n
|
110
|
0x6E
|
111
|
0x6F
|
LATIN SMALL LETTER O
|
o
|
111
|
0x6F
|
8. 111----127
GSM 7Bit Decimal
|
Hex
|
Character Name
|
CharacterISO-8859-1
|
Decimal
|
Hex
|
112
|
0x70
|
LATIN SMALL LETTER P
|
p
|
112
|
0x70
|
113
|
0x71
|
LATIN SMALL LETTER Q
|
q
|
113
|
0x71
|
114
|
0x72
|
LATIN SMALL LETTER R
|
r
|
114
|
0x72
|
115
|
0x73
|
LATIN SMALL LETTER S
|
s
|
115
|
0x73
|
116
|
0x74
|
LATIN SMALL LETTER T
|
t
|
116
|
0x74
|
117
|
0x75
|
LATIN SMALL LETTER U
|
u
|
117
|
0x75
|
118
|
0x76
|
LATIN SMALL LETTER V
|
v
|
118
|
0x76
|
119
|
0x77
|
LATIN SMALL LETTER W
|
w
|
119
|
0x77
|
120
|
0x78
|
LATIN SMALL LETTER X
|
x
|
120
|
0x78
|
121
|
0x79
|
LATIN SMALL LETTER Y
|
y
|
121
|
0x79
|
122
|
0x7A
|
LATIN SMALL LETTER Z
|
z
|
122
|
0x7A
|
123
|
0x7B
|
LATIN SMALL LETTER A WITH DIAERESIS
|
ä
|
228
|
0xE4
|
124
|
0x7C
|
LATIN SMALL LETTER O WITH DIAERESIS
|
ö
|
246
|
0xF6
|
125
|
0x7D
|
LATIN SMALL LETTER N WITH TILDE
|
ñ
|
241
|
0xF1
|
126
|
0x7E
|
LATIN SMALL LETTER U WITH DIAERESIS
|
ü
|
252
|
0xFC
|
127
|
0x7F
|
LATIN SMALL LETTER A WITH GRAVE
|
à
|
224
|
0xE0
|
部分字符不可见, 附图1注意事项:空位使用0填充(图中6字节的情况),当编码后最后一个字节空位刚好为7位时(图中7字节的情况),改为使用字符CR(0x0d)填充, 避免填充后多余字节0x00与c语言字符串结尾符号0x00的冲突编码过程示例
|