fixed decoding bug
authorpycage <martin.grimme@gmail.com>
Wed, 6 Jan 2010 20:59:16 +0000 (20:59 +0000)
committerpycage <martin.grimme@gmail.com>
Wed, 6 Jan 2010 20:59:16 +0000 (20:59 +0000)
git-svn-id: file:///svnroot/ussd-widget/trunk@7 d197f4d6-dc93-42ad-8354-0da1f58e353f

ussd-common/src/usr/lib/python2.5/gsmdecode.py

index f1b727c..924c24a 100644 (file)
@@ -165,7 +165,7 @@ def decode(s, n):
     # separate into nibbles
     hbits = (n & 0xf0) >> 4
     lbits = (n & 0x0f)
-
+    
     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
-    if (l == 0x0):
+
+    if (alphabet == 0x0):
         # 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)
         
-    elif (l == 0x2):
+    elif (alphabet == 0x2):
         # USC2 (16 bit, BE)
         return _decode_usc2(s)
-    elif (l == 0x3):
+    elif (alphabet == 0x3):
         # reserved
         return s