ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> i18n-sig
i18n-sig
[I18n-sig] UnicodeDecodeError Ubuntu-Debian
by Asim Yildiz other posts by this author
Aug 1 2008 8:16AM messages near this date
Love package at a low prices | beatrice discovery
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=MYSQL.Connection(host="localhost",user="faksmakinesi",passwd="faksmakinesi1234",db="faksm
akinesi", 
use_unicode="true", charset="utf8")
        except MYSQL.Error, e:
                return "h1090"
        isaretci = db.cursor()
        sorgu = "select * from kullanicilar where kullanici_adi='%s'" % 
(param)
        isaretci.execute(sorgu)
        sonuc=isaretci.fetchall()
        print sonuc[0][0]
        db.close()
        return "ok"

a('Å?')


"</SampleCode> "
_______________________________________________
I18n-sig mailing list
I18n-sig@[...].org
http://mail.python.org/mailman/listinfo/i18n-sig

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved