Maybe I need to backup at bit. I am somewhat confused at this point. I need
to insert a string which contains a non-ascii character into my database
table, that character is Ch0xE9rie. E9 is the hex representation of the
acute-e. Do I need unicode to do this, do I need to change the charset? What
are my options?

Thanks

 Glenn

On Jan 7, 2008 12:45 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:

> On Mon, Jan 07, 2008 at 12:35:40PM -0500, Glenn MacGregor wrote:
> > #!/usr/bin/python
> > # -*- coding: utf-8 -*-
> >
> > import os, sys, glob MySQLdb
> > from sqlobject import *
> >
> > sqlhub.processConnection = connectionForURI('mysql://test:[EMAIL PROTECTED]
> > /test?charset=utf8&use_unicode=1
> >
> > class Temp(SQLObject):
> >     class sqlmeta:
> >         table = "temp"
> >         fromDatabase = True
> >
> >     def add(label):
> >         return Temp(label=label)
> >
> >     add = staticmethod(add)
> >
> >
> > a = 'Ch?rie'
> >
> > t = Temp.add(a)
> >
> > print 'Done'
>
>   Declare the column as non-unicode:
>
> class Temp(SQLObject):
>    class sqlmeta:
>        table = "temp"
>        fromDatabase = True
>
>    label = StringCol()
>
>
>   Or stop using unicode at all:
>
> sqlhub.processConnection = connectionForURI('mysql://test:[EMAIL PROTECTED]
> /test')
>
> Oleg.
> --
>     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
>           Programmers don't die, they just GOSUB without RETURN.
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to