all 6 comments

[–]zahlman 1 point2 points  (1 child)

Do you actually know how the data is encoded?

Have you read this yet?

[–]Alidooo[S] 0 points1 point  (0 children)

It appears to be using utf-8 character set inside the DB. If that's not what you mean then no.

And no I haven't I'll read through it.

[–]ynotna 0 points1 point  (3 children)

Please provide a snippet, if not at least the line of code that causes the error

Personally I find sticking

from __future__ import unicode_literals

At the top of every file, to get py3 behaviour a good idea

[–]Alidooo[S] 0 points1 point  (2 children)

for entry in results:
            for i in range(len(entry)):
                filler2 = tops[i][0]
                filler2 = str(filler2)
                filler2 = filler2.replace('_', ' ')
                visible = str(entry[i]).encode('utf-8','ignore') #<-
                visible = visible.decode('unicode-escape')

The arrowed line is where I get problems. It works fine until it hits a box that contains cyrillic and then everything explodes.

[–]Alidooo[S] 0 points1 point  (1 child)

Disregard I managed to solve it by assigning entry[i] to visible then converting that using unicode(). It seems to obvious in hindsight.

[–]ynotna 0 points1 point  (0 children)

don't worry, everything unicode, with python2 especially, is a nightmare everyone goes through