It was not possible to find a way by myself. thats maybe cause im new in
python / django.
i know there is one who can helps...
it will be very friendly for a usable response. :)
Am Dienstag, 27. November 2012 09:49:37 UTC+1 schrieb Nebros:
> 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 "ü".
> 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ö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?
>
--
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/-/lVFpWJlTT-MJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.