projects
/
ussd-widget
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed decoding bug
[ussd-widget]
/
ussd-common
/
src
/
usr
/
lib
/
python2.5
/
gsmdecode.py
diff --git
a/ussd-common/src/usr/lib/python2.5/gsmdecode.py
b/ussd-common/src/usr/lib/python2.5/gsmdecode.py
index
f1b727c
..
924c24a
100644
(file)
--- a/
ussd-common/src/usr/lib/python2.5/gsmdecode.py
+++ b/
ussd-common/src/usr/lib/python2.5/gsmdecode.py
@@
-165,7
+165,7
@@
def decode(s, n):
# separate into nibbles
hbits = (n & 0xf0) >> 4
lbits = (n & 0x0f)
# separate into nibbles
hbits = (n & 0xf0) >> 4
lbits = (n & 0x0f)
-
+
if (hbits == 0x0):
# language
return _decode_language(s, lbits)
if (hbits == 0x0):
# language
return _decode_language(s, lbits)
@@
-217,20
+217,21
@@
def _decode_general_data_coding(s, h, l):
is_compressed = (h & 0x2)
alphabet = (l & 0xc) >> 2
is_compressed = (h & 0x2)
alphabet = (l & 0xc) >> 2
- if (l == 0x0):
+
+ if (alphabet == 0x0):
# default alphabet
return _decode_defaul_alphabet(s)
# default alphabet
return _decode_defaul_alphabet(s)
- elif (l == 0x1):
+ elif (alphabet == 0x1):
# 8 bit
# actually, encoding is user-defined, but let's assume hex'd ASCII
# for now
return _decode_hex(s)
# 8 bit
# actually, encoding is user-defined, but let's assume hex'd ASCII
# for now
return _decode_hex(s)
- elif (l == 0x2):
+ elif (alphabet == 0x2):
# USC2 (16 bit, BE)
return _decode_usc2(s)
# USC2 (16 bit, BE)
return _decode_usc2(s)
- elif (l == 0x3):
+ elif (alphabet == 0x3):
# reserved
return s
# reserved
return s