Re: utf-8 and database models

2007-01-31 Thread Michael Radziej

Hi Joseph,

Joseph Wenninger:
> I'm using an sqlite database with a model which has a Charfield named 
> filepath.
> 
> I'm trying to store an "utf-8" string there. I tried passing it as a byte 
> string and as a unicode object. Saving works fine, but if I try to access the 
> field I'm always getting:
> 
> "Could not decode to UTF-8 column 'filepath' with text ."
> 
> How do I correctly pass utf-8 strings to a model ? Could somebody give me 
> hints how to solve this ?

The correct way is to put an utf-8 encoded bytestring into it, like
you did. settings.DEFAULT_CHARSET must be 'UTF-8', other settings
won't work.

Are forms involved into this anyhow? newforms puts unicode into the
models, and we currently have bugs with that.

If it doesn't work, please open a ticket, and include exactly what
you did to cause the bug, and the backtrace. {{{ and }}} around the
code and the backtrace will make look it "pretty". it would be even
better if you can give us a minimal testcase that demonstrates the
issue down to the point.

Hope that helps a bit,

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100

http://www.noris.de - The IT-Outsourcing Company

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



utf-8 and database models

2007-01-31 Thread Joseph Wenninger

Hi!

I'm using an sqlite database with a model which has a Charfield named 
filepath.

I'm trying to store an "utf-8" string there. I tried passing it as a byte 
string and as a unicode object. Saving works fine, but if I try to access the 
field I'm always getting:

"Could not decode to UTF-8 column 'filepath' with text ."

How do I correctly pass utf-8 strings to a model ? Could somebody give me 
hints how to solve this ?

Kind regards
Joseph Wenninger

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---