OK so I have # -*- coding: utf-8 -*-
at the top of my script and it worked for being able to pull data from the database that had funny chars(Ñ ,Õ,é,—,–,’,…) in it
#-*- coding: xxx -*-
has nothing to do with this error, it only applies to the encoding of the source file it is declared in, not the content of variables coming from a database.
Your error says that you try to pass a str
type object containing non ASCII characters to the unicode()
constructor (which is called at line 43 of suds/sax/text.py).
You have to convert the strings coming from the database to unicode
objects ; for example if your database is encoded in UTF-8:
title = product[1].decode("UTF-8")
See the str.decode() documentation for details.