Re: pyodbc utf-8
Can that be, that my computer have the problem and not python itself?
Am Dienstag, 27. November 2012 09:49:37 UTC+1 schrieb Nebros:
--Hello communityi 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 "ü".on my html.page i made this into the header:<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örgwhen 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 foundi dont know how i can fix my problem... what i use:win7 32bitpython 2.7django 1.4.1pyodbc 3.0.6can someone halp me to fix this problem?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/S8otKqKqLccJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home