Skip to content

Commit 396ec22

Browse files
committed
DBManager: fix int/float conversion to unicode (partially revert changes in 401f43c and fix #13505)
1 parent 01b4554 commit 396ec22

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/plugins/db_manager/db_plugins/data_model.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ def data(self, index, role):
7676
elif isinstance(val, (str, unicode)) and len(val) > 300:
7777
# too much data to display, elide the string
7878
val = val[:300]
79-
return unicode(val, 'utf-8', 'replace') # convert from utf8 and replace errors (if any)
79+
try:
80+
return unicode(val) # convert to unicode
81+
except UnicodeDecodeError:
82+
return unicode(val, 'utf-8', 'replace') # convert from utf8 and replace errors (if any)
8083

8184
def headerData(self, section, orientation, role):
8285
if role != Qt.DisplayRole:

0 commit comments

Comments
 (0)