Can you attach a traceback for that?

Sent from my iPhone

On Sep 29, 2011, at 7:45 AM, Benjamin Sims <benjamins...@gmail.com> wrote:

> I've recently moved from SQLite to MySQL as the underlying database for my 
> application. The move is causing me various problems, principally around 
> Unicode. I *think* they were not occurring when SQLite was there, so I 
> thought I would ask if anybody on the list has had similar problems.
> 
> My current difficultly is that when saving content (Chinese, generally) to 
> the database, I get the dreaded:
> 
> *** UnicodeEncodeError: 'ascii' codec can't encode characters in position 
> 0-4: ordinal not in range(128)
> 
> error and a rollback.
> 
> I have checked that:
> 
> - the MySQL table has a suitable encoding (CHARACTER SET utf8 COLLATE 
> utf8_general_ci;)
> - the MySQL connection string has the charset on the end (?charset=utf8)
> - The type for the relevant Column is Unicode (this worked previously with 
> just string, but I have changed it anyway just in case)
> - The content is unicode at the point it gets sent to the the database 
> (again, this was a plain string previously but seemed to work)
> 
> However, on save I get the above error from SQLAlchemy. What do I need to be 
> doing to get the content in the right format to send through?
> 
> Thanks,
> Ben
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to