On Oct 4, 2007, at 5:07 AM, Werner F. Bruhin wrote:

>
> I have just started to work with sqlalchemy and there is one thing I
> can't figure out.
>
> I am using Firebird SQL 2.0 and kinterbasdb 3.2, and I have some blob
> columns defined as:
>
> NOTES           MEMO /* MEMO = BLOB SUB_TYPE 1 SEGMENT SIZE 80 */,
>
> CREATE DOMAIN MEMO AS
> BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET ISO8859_1;
>
> The call to create_engine includes " encoding='utf-8'," but any blob
> column is returned as a string instead of Unicode.
>
> varchar columns are returned as Unicode.
>
> I am working on an existing database, so I adapted the script from on
> this page http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode  
> and
> it generated the model for the notes column as "sa.Column( u'notes',
> sa.TEXT(length=None,convert_unicode=False))".
>
> So, first I thought it had to do with the convert_unicode param but  
> the
> same is used on the varchar fields which work fine for me.
>
> Can anyone point out what I am doing wrong.

you should have the convert_unicode=True param set on the TEXT  
column.  that will apply the engine's encoding of "utf-8" to the  
encoded strings returned from the database.  if you have VARCHAR  
fields which dont have this flag set, but they are still coming back  
as unicode, then its probably a product of kinterbasdb doing it (i  
dont use firebird over here).



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to