Hello community
i have a next problem. i have connected with pyodbc to a mssql db. i read values out of it, all works, but i have problems with "ä" "ö" and "ü".
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
on all my pages this umlauts works, but not the values of the pyodbc...
when i only give out the row, i become something like this: Hansj\xf6rg ,but it have to be this: Hansjörg
when i print this value out into a table, the field keeps empty.
it must be a problem of pyodbc, but i dont know how to fix it. i tryed something like this:
views.py --------------------------------------------------------
def kundendaten(request):
ret = request.POST
form = ret['kunde']
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=MAURITIUS;DATABASE=baan5c;UID=portal;PWD=P0rtalReader')
cursor = conn.cursor()
cursor.execute("SELECT x.t_name, x.t_user, y.t_mail FROM tttaad200000 as x, tttcmf200000 as y WHERE (x.t_name = y.t_name) AND (x.t_user = '%s')"%form)
rows = unicode(cursor.fetchall(), 'utf-8')
now = datetime.datetime.now()
return render_to_response("kundendaten.html", { 'rows': rows, 'current_date': now, 'form': form}, context_instance=RequestContext(request))
---------------------------------------------------------------------
but the page gave this error:
TypeError at /kundendaten/
coercing to Unicode: need string or buffer, list found
i dont know how i can fix my problem... what i use:
win7 32bit
python 2.7
django 1.4.1
pyodbc 3.0.6
can someone halp me to fix this problem?