Skip to content

Commit c25e13a

Browse files
committed
Decode used only on python's 8-bit strings
- Version 4.3.1
1 parent b39029f commit c25e13a

4 files changed

Lines changed: 3 additions & 18 deletions

File tree

18 Bytes
Binary file not shown.
18 Bytes
Binary file not shown.
18 Bytes
Binary file not shown.

AndroidViewClient/src/com/dtmilano/android/viewclient.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@author: Diego Torres Milano
1919
'''
2020

21-
__version__ = '4.2.1'
21+
__version__ = '4.3.1'
2222

2323
import sys
2424
import subprocess
@@ -902,26 +902,11 @@ def __str__(self):
902902
__str = unicode("View[", 'utf-8', 'replace')
903903
if "class" in self.map:
904904
__str += " class=" + self.map["class"].__str__() + " "
905-
import chardet
906905
for a in self.map:
907906
__str += a + "="
907+
# decode() works only on python's 8-bit strings
908908
if isinstance(self.map[a], unicode):
909-
encoding = chardet.detect(self.map[a])['encoding']
910-
#print >> sys.stderr, "%%%%% encoding", repr(a), repr(self.map[a]), encoding
911-
if encoding:
912-
#print >> sys.stderr,"%%%%% decode", encoding, type(self.map[a])
913-
#print >> sys.stderr, "%%%%% decode", self.map[a].decode(encoding, errors='ignore')
914-
try:
915-
decoded = self.map[a].decode(encoding, errors='replace')
916-
except UnicodeEncodeError, ex:
917-
print >> sys.stderr, "%%%%%%%% ERROR", ex
918-
decoded = u'DECODE_ERROR:' + encoding
919-
try:
920-
__str += decoded.encode('utf-8', errors='replace')
921-
except UnicodeEncodeError:
922-
__str += u'UNICODE_ERROR'
923-
else:
924-
__str += self.map[a].encode('utf-8', errors='replace')
909+
__str += self.map[a]
925910
else:
926911
__str += unicode(str(self.map[a]), 'utf-8', errors='replace')
927912
__str += " "

0 commit comments

Comments
 (0)