Skip to content

Commit 85fd681

Browse files
authoredApr 27, 2018
Merge pull request #6871 from borysiasty/dbmanager_unicode_fix
[DBManager] Fix encoding error if a field/table/database/file name co…
2 parents 9ce55ca + e5aaf6a commit 85fd681

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎python/plugins/db_manager/db_plugins/html_elems.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ def toHtml(self):
3636
if hasattr(self.data, 'toHtml'):
3737
return self.data.toHtml()
3838

39-
html = unicode(self.data).replace("\n", "<br>")
39+
if isinstance(self.data, str):
40+
html = unicode(self.data, encoding='utf-8', errors='replace')
41+
elif isinstance(self.data, unicode):
42+
html = self.data
43+
else:
44+
html = unicode(self.data)
45+
html = html.replace("\n", "<br>")
46+
4047
return html
4148

4249
def hasContents(self):

0 commit comments

Comments
 (0)
Please sign in to comment.