what is your exact sqlobject, mysqldb version and mysql version? Basil Shubin a écrit : > Hi friends, > > sophana пишет: > [skip] > >> But when I use ?use_unicode=1&sqlobject_encoding=utf8&charset=utf8 >> It now works! > > With this '?use_unicode=1&sqlobject_encoding=utf8&charset=utf8' I got > the following error: > /usr/lib/python2.4/site-packages/sqlobject/mysql/mysqlconnection.py:74: > Warning: Data truncated for column 'title' at row 1 > return cursor.execute(myquery) > > For detailed information, please, examine source code in attachment. > ------------------------------------------------------------------------ > > # -*- coding: utf-8 -*- > > from sqlobject import * > #from lib.dbsql import * > from dbsql import * > > > class Database: > > def __init__(self, user, password, database, server): > connString = user + ':' + password + '@' + server + '/' + database > unicodeString = '?use_unicode=1&sqlobject_encoding=utf8&charset=utf8' > connection = connectionForURI('mysql://' + connString + unicodeString) > TownTable._connection = connection > > TownTable.createTable(ifNotExists=True) > > def SelectTowns(self): > towns = TownTable.select() > listOfTowns = [] > for town in towns: > listOfTowns.append([town.title, town.country, town.id]) > return listOfTowns > > def InsertTown(self, title, country): > town = TownTable(title=title, country=country) > > > if __name__ == '__main__': > db = Database('dbuser', 'dbpassword', 'demodb', 'localhost') > > db.InsertTown('п║я┌я─п╣п╤п╣п╡п╬п╧', 1) > > > ------------------------------------------------------------------------ > > # -*- coding: utf-8 -*- > > from sqlobject import * > > > class TownTable(SQLObject): > > title = UnicodeCol() > country = IntCol() >
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss