UnicodeDecodeError Ubuntu-Debian
asim yildiz <[email protected]> Fri, 01 Aug 2008 18:09:04 +0300
| Newsgroups | gmane.comp.python.internationalization |
|---|---|
| Message-ID | <[email protected]> |
i have an ubuntu 7.10 installed machine and debian etch installed server.
i have a python code that runs on my ubuntu without problem, but in =
server it gives UnicodeDecodeError, is there anyway except decoding the =
parameters to unicode by "unicode(param, 'utf-8')" command to get rid of =
this error.
any help will be appreciated.
thx.
"<SampleCode>"
#! /usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb as MYSQL
import locale
locale.setlocale(locale.LC_ALL, 'C')
#also if i changed locale to "tr_TR.utf8" i faced with a "ROUND CEILING" =
error
def a(param):
try:
=
db=3DMYSQL.Connection(host=3D"localhost",user=3D"faksmakinesi",passwd=3D"fa=
ksmakinesi1234",db=3D"faksmakinesi", =
use_unicode=3D"true", charset=3D"utf8")
except MYSQL.Error, e:
return "h1090"
isaretci =3D db.cursor()
sorgu =3D "select * from kullanicilar where kullanici_adi=3D'%s'" % =
(param)
isaretci.execute(sorgu)
sonuc=3Disaretci.fetchall()
print sonuc[0][0]
db.close()
return "ok"
a('=FE')
"</SampleCode>"