从乱码短信谈短信解码

 

从乱码短信谈短信解码

 

某项目接收到乱码短信:

Ω f T K p ! C ù

 

从底层读出其内容数据为:0x15,0x33,0x75,0x0d,到第80byte数据都是0x0d,最后一个byte0x07

 

由此为例,分析7bit解码过程: 

 

方法1

Hex

0x15

0x33

0x75

 0x0d

Dec

0001 0101

00110011

01110101

00001101

截取

0001 0101

00110011

01110101

00001101

补位

001 0101

110011 0

10101 00

1101 011

查表

Ω

f

T

K

 

方法2

Hex

0x15

0x33

0x75

 0x0d

倒排

0x0d

0x75

0x33

0x15

Dec

00001101

01110101

00110011

0001 0101

截取

0000 1101

011 10101

00 110011

0 001 0101

补位

1101 011

10101 00

110011 0

0010101

查表

K

T

f

Ω

倒排

Ω

f

T

K

 


 

附编码(选自7bit_default_table pud格式7bit编码对应表):

                           

注意事项:空位使用0填充(图中6字节的情况),当编码后最后一个字节空位刚好为7位时(图中7字节的情况),改为使用字符CR(0x0d)填充, 避免填充后多余字节0x00c语言字符串结尾符号0x00的冲突

编码过程示例


附7bit default table:

Character

GSM 7-bit default alphabet

(Decimal)

GSM 7-bit default alphabet

(Hexadecimal)

ISO 8859 Latin 1

(Decimal)

ISO 8859 Latin 1

(Hexadecimal)

@

At sign

0

00

64

40

£

Pound sign

1

01

163

A3

$

Dollar sign

2

02

36

24

¥

Yuan/Yen sign

3

03

165

A5

è

Small letter e with grave accent

4

04

232

E8

é

Small letter e with acute accent

5

05

233

E9

ù

Small letter u with grave accent

6

06

249

F9

ì

Small letter i with grave accent

7

07

236

EC

ò

Small letter o with grave accent

8

08

242

F2

Ç

Capital letter C with cedilla

9

09

199

C7


Linefeed

10

0A

10

0A

Ø

Capital letter O with stroke

11

0B

216

D8

ø

Small letter o with stroke

12

0C

248

F8


Carriage return

13

0D

13

0D

Å

Capital letter A with ring

14

0E

197

C5

å

Small letter a with ring

15

0F

229

E5

Δ

Capital letter Greek delta

16

10



_

Underscore

17

11

95

5F

Φ

Capital letter Greek phi

18

12



Γ

Capital letter Greek gamma

19

13



Λ

Capital letter Greek lambda

20

14



Ω

Capital letter Greek omega

21

15



Π

Capital letter Greek pi

22

16



Ψ

Capital letter Greek psi

23

17



Σ

Capital letter Greek sigma

24

18



Θ

Capital letter Greek theta

25

19



Ξ

Capital letter Greek xi

26

1A




Escape

27

1B




Form feed

27 10

1B0A

12

0C

^

Caret / Circumflex

27 20

1B14

94

5E

{

Left curly bracket

27 40

1B28

123

7B

}

Right curly bracket

27 41

1B29

125

7D

\

Backslash

27 47

1B2F

92

5C

[

Left square bracket

27 60

1B3C

91

5B

~

Tilde

27 61

1B3D

126

7E

]

Right square bracket

27 62

1B3E

93

5D

|

Vertical bar

27 64

1B40

124

7C

Euro sign

27 101

1B65



Æ

Capital letter AE

28

1C

198

C6

æ

Small letter ae

29

1D

230

E6

ß

Small letter German Eszett

30

1E

223

DF

É

Capital letter E with acute accent

31

1F

201

C9


Space

32

20

32

20

!

Exclamation mark

33

21

33

21

"

Quotation mark

34

22

34

22

#

Number sign

35

23

35

23

¤

Currency sign

36

24

164

A4

%

Percent sign

37

25

37

25

&

Ampersand

38

26

38

26

'

Apostrophe

39

27

39

27

(

Left parenthesis

40

28

40

28

)

Right parenthesis

41

29

41

29

*

Asterisk

42

2A

42

2A

+

Plus sign

43

2B

43

2B

,

Comma

44

2C

44

2C

-

Minus sign / Hyphen

45

2D

45

2D

.

Full stop / Period

46

2E

46

2E

/

Slash

47

2F

47

2F

0

Digit zero

48

30

48

30

1

Digit one

49

31

49

31

2

Digit two

50

32

50

32

3

Digit three

51

33

51

33

4

Digit four

52

34

52

34

5

Digit five

53

35

53

35

6

Digit six

54

36

54

36

7

Digit seven

55

37

55

37

8

Digit eight

56

38

56

38

9

Digit nine

57

39

57

39

:

Colon

58

3A

58

3A

;

Semicolon

59

3B

59

3B

<

Less-than sign

60

3C

60

3C

=

Equals sign

61

3D

61

3D

>

Greater-than sign

62

3E

62

3E

?

Question mark

63

3F

63

3F

¡

Inverted exclamation mark

64

40

161

A1

A

Capital letter A

65

41

65

41

B

Capital letter B

66

42

66

42

C

Capital letter C

67

43

67

43

D

Capital letter D

68

44

68

44

E

Capital letter E

69

45

69

45

F

Capital letter F

70

46

70

46

G

Capital letter G

71

47

71

47

H

Capital letter H

72

48

72

48

I

Capital letter I

73

49

73

49

J

Capital letter J

74

4A

74

4A

K

Capital letter K

75

4B

75

4B

L

Capital letter L

76

4C

76

4C

M

Capital letter M

77

4D

77

4D

N

Capital letter N

78

4E

78

4E

O

Capital letter O

79

4F

79

4F

P

Capital letter P

80

50

80

50

Q

Capital letter Q

81

51

81

51

R

Capital letter R

82

52

82

52

S

Capital letter S

83

53

83

53

T

Capital letter T

84

54

84

54

U

Capital letter U

85

55

85

55

V

Capital letter V

86

56

86

56

W

Capital letter W

87

57

87

57

X

Capital letter X

88

58

88

58

Y

Capital letter Y

89

59

89

59

Z

Capital letter Z

90

5A

90

5A

Ä

Capital letter A with diaeresis

91

5B

196

C4

Ö

Capital letter O with diaeresis

92

5C

214

D6

Ñ

Capital letter N with tilde

93

5D

209

D1

Ü

Capital letter U with diaeresis

94

5E

220

DC

§

Section sign

95

5F

167

A7

¿

Inverted question mark

96

60

191

BF

a

Small letter a

97

61

97

61

b

Small letter b

98

62

98

62

c

Small letter c

99

63

99

63

d

Small letter d

100

64

100

64

e

Small letter e

101

65

101

65

f

Small letter f

102

66

102

66

g

Small letter g

103

67

103

67

h

Small letter h

104

68

104

68

i

Small letter i

105

69

105

69

j

Small letter j

106

6A

106

6A

k

Small letter k

107

6B

107

6B

l

Small letter l

108

6C

108

6C

m

Small letter m

109

6D

109

6D

n

Small letter n

110

6E

110

6E

o

Small letter o

111

6F

111

6F

p

Small letter p

112

70

112

70

q

Small letter q

113

71

113

71

r

Small letter r

114

72

114

72

s

Small letter s

115

73

115

73

t

Small letter t

116

74

116

74

u

Small letter u

117

75

117

75

v

Small letter v

118

76

118

76

w

Small letter w

119

77

119

77

x

Small letter x

120

78

120

78

y

Small letter y

121

79

121

79

z

Small letter z

122

7A

122

7A

ä

Small letter a with diaeresis

123

7B

228

E4

ö

Small letter o with diaeresis

124

7C

246

F6

ñ

Small letter n with tilde

125

7D

241

F1

ü

Small letter u with diaeresis

126

7E

252

FC

à

Small letter a with grave accent

127

7F

224

E0

posted on 2010-06-01 09:54 八零未成年 阅读(1189) 评论(0)  编辑 收藏 引用 所属分类: MTK


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理


<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

统计

常用链接

留言簿

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜