Hi Ian,

I just tried the ctypes solution that you mentioned in your previous email
but it does not work for me.

Below is my session transcripts.

>>> import ctypes
*>>> ctypes.CDLL('kernel32').SetEnvironmentVariableA('NLS_LANG', '.UTF8')*
*1*
>>> TerminologyMap.objects.get(term_id=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py", line
132, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line
336, in get
    num = len(clone)
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line
81, in __len__
    self._result_cache = list(self.iterator())
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line
269, in iterator
    for row in compiler.results_iter():
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/compiler.py",
line 672, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/compiler.py",
line 741, in <lambda>
    result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
  File "/usr/lib/python2.5/site-packages/django/db/backends/oracle/base.py",
line 552, in fetchmany
    for r in self.cursor.fetchmany(size)])
  File "/usr/lib/python2.5/site-packages/django/db/backends/oracle/base.py",
line 625, in _rowfactory
    value = to_unicode(value)
  File "/usr/lib/python2.5/site-packages/django/db/backends/oracle/base.py",
line 636, in to_unicode
    return force_unicode(s)
  File "/usr/lib/python2.5/site-packages/django/utils/encoding.py", line 88,
in force_unicode
    raise DjangoUnicodeDecodeError(s, *e.args)
django.utils.encoding.DjangoUnicodeDecodeError: 'utf8' codec can't decode
bytes in position 22-24: invalid
 data. You passed in 'Registro guardado con \xe9xito' (<type 'str'>)

Regards,
Anurag

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

> On Thu, Dec 2, 2010 at 3:23 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> > Weird.  From what I can tell, this seems to have something to do with
> > Cygwin, or at least I'm able to replicate it in that environment.
> > Setting NLS_LANG in or out of process and changing the registry key
> > all have no effect.
>
> The actual problem is described here:
>
> http://rubyforge.org/forum/forum.php?thread_id=6826&forum_id=1078
>
> and from the cx-oracle-users mailing list comes this suggestion:
>
> >>> import ctypes
> >>> ctypes.CDLL('kernel32').SetEnvironmentVariableA('NLS_LANG', '.UTF8')
>
> I've tried it, and it works.  I suggest patching the above into your
> django/db/backends/oracle/base.py file, in place of the line:
>
> os.environ['NLS_LANG'] = '.UTF8'
>
> Cheers,
> 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