Firstly, I am pretty new to python, so forgive me for all the n00b stuff. So the application logic in Python goes like this:
- I am sending and SQL Select to database and it returns an array of data.
- I need to take this data and use it in another SQL insert sentence.
Now the problem is, that SQL query returns me unicode strings. The output from select is something like this:
(u'Abc', u'Lololo', u'Fjordk\xe6r')
So first I was trying to convert it string, but it fails as the third element contains this german 'ae' letter:
for x in data[0]:
str_data.append(str(x))
I am getting: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe6' in position 6: ordinal not in range(128)
I can insert unicode straightly to insert also as TypeError occurs. TypeError: coercing to Unicode: need string or buffer, NoneType found
Any ideas?