# separate into nibbles
hbits = (n & 0xf0) >> 4
lbits = (n & 0x0f)
-
+
if (hbits == 0x0):
# language
return _decode_language(s, lbits)
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