Thanks Malcolm.

Appreciate you taking time to respond. When i posted the first
question on unicode,  I really wanted to know if there is a setting in
Django where I can tell it to use 'str' objects (with a particular
encoding). Jacob's response answered that. At this point I have the
test suite running and trying to get clarity on things remaining that
I need to address. I wanted an easy way to remove the encoding
failures to get a better picture of the count of remaining failures.

Regards,
Ambrish Bhargava

On Dec 4, 10:51 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2008-12-03 at 21:42 -0800, Ambrish Bhargava wrote:
> > Hi,
>
> > Its the other way around, the database for sure does support unicode,
> > the driver does not handle it as of yet, which is planned for shortly.
> > The database is DB2. Did not know i was concealing that.
>
> Unicode isn't really the issue here. It's whether you can pass through
> an encoding of Unicode. In particular, can you pass UTF-8 encoded
> strings to through the backend. If you can't, what can you pass? Only
> ASCII (please say no)?
>
> Sure, a nice driver would be able to do the conversion to and from
> unicode inside the driver, but some can't (e.g. cx_oracle). But the
> driver has to be able to support a decent set of byte encodings, so you
> convert from Python's unicode object to those sorts of bytestrings.
>
> If the driver doesn't handle UTF-8 (or UTF-16 or some way of encoding
> unicode), then you can't do anything about it, except point out to
> people that those characters will just fail mysteriously. You should
> still be able to convert from unicode to whatever encoding you can
> handle and back into unicode when going from the database -> Django.
> Have a look at how the Oracle backend does this for an example
> (django/db/backends/oracle/base.py in the
> FormatStylePlaceholderCursor.execute() method, to pick one case). We do
> the conversion to UTF-8 in the Django backend there. You could replace
> UTF-8 with encoding-of-choice and then error out if somebody passes you
> non-convertable data. Check the signature of the smart_str() method to
> see how to set encoding and errors.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to