Hi Ian,

Here is the information requested by you.

$ python
Python 2.5.2 (r252:60911, Dec  2 2008, 09:26:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print os.environ['NLS_LANG']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/UserDict.py", line 22, in __getitem__
    raise KeyError(key)
KeyError: 'NLS_LANG'
>>> from django.db import connection
>>> connection.cursor()  # Initialize the connection
>>> print os.environ['NLS_LANG']
.UTF8
>>> print connection.connection.encoding
WINDOWS-1252
>>> print connection.connection.nencoding
WINDOWS-1252
>>>

Regards,
Anurag

On Fri, Dec 3, 2010 at 12:06 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote:

> On Thu, Dec 2, 2010 at 6:43 AM, Anurag Chourasia
> <anurag.choura...@gmail.com> wrote:
> > Hi Ian,
> > Yes.....I set the NLS_LANG in my shell to UTF8 before trying this.
> > Query using Django model still fails (direct query using cx_Oracle works
> > fine)
> > Regards,
> > Anurag
>
> Okay, so it would appear that the client encoding is not being honored
> by Oracle for some reason.  Just to verify that Django is setting it
> correctly in the first place, would you please try the following in a
> Django shell and let me know what you get?
>
> >>> import os
> >>> print os.environ['NLS_LANG']
> >>> from django.db import connection
> >>> connection.cursor()  # Initialize the connection
> >>> print os.environ['NLS_LANG']
> >>> print connection.connection.encoding
> >>> print connection.connection.nencoding
>
> If everything is correct then the second NLS_LANG should be ".UTF8"
> and both encodings should be "UTF-8".  If that is the case then I
> think your next step should be to try the cx_Oracle mailing list.
> Perhaps Anthony or somebody else there will have some idea why
> cx_Oracle or OCI are returning strings with the wrong encoding.
>
> Otherwise, we will need to figure out why the client encoding is not
> being set correctly by Django.
>
> Ian
>

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

Reply via email to