Dear all,

I'm using Django 1.0.2 with Oracle 9i, cx_Oracle 5.0, Oracle Instantclient
10.2.0.4 and CentOS 5.2.

When I access the admin page, after login, the following error happens:

*'ascii' codec can't encode characters in position 0-42: ordinal not
in range(128)*

 *Unicode error hint*

*The string that could not be encoded/decoded was:
䅧㥊兣噆湃汒㍣橒㉢爹坡硖汁䝕㉤礹㉡歖兣穎浌睍坙穅䝎穉㉙㑅橙㕅䝍睙呙橆橎さ積㉫伊兔䵷䉺੩�c�b�*
(complete traceback here: http://dpaste.com/111479/)

All files have the utf8 coding and the database is empty.

I added the following in settings.py:
*
import cx_Oracle
conn = cx_Oracle.Connection('***/*...@***')
cursor = conn.cursor()
result1 = cursor.execute('select * from nls_database_parameters')
result2 = cursor.execute('select * from nls_session_parameters')
print 'Database ', result1.fetchall()
print 'Session ', result2.fetchall()*

And the result when running "./manager.py runserver" was:
*Database  [('NLS_LANGUAGE', 'AMERICAN'), ('NLS_TERRITORY', 'AMERICA'),
('NLS_CURRENCY', '$'), ('NLS_ISO_CURRENCY', 'AMERICA'),
('NLS_NUMERIC_CHARACTERS', '.,'), ('NLS_CALENDAR', 'GREGORIAN'),
('NLS_DATE_FORMAT', 'DD-MON-RR'), ('NLS_DATE_LANGUAGE', 'AMERICAN'),
('NLS_SORT', 'BINARY'), ('NLS_TIME_FORMAT', 'HH.MI.SSXFF AM'),
('NLS_TIMESTAMP_FORMAT', 'DD-MON-RR HH.MI.SSXFF AM'), ('NLS_TIME_TZ_FORMAT',
'HH.MI.SSXFF AM TZR'), ('NLS_TIMESTAMP_TZ_FORMAT', 'DD-MON-RR HH.MI.SSXFF AM
TZR'), ('NLS_DUAL_CURRENCY', '$'), ('NLS_COMP', 'BINARY'),
('NLS_LENGTH_SEMANTICS', 'BYTE'), ('NLS_NCHAR_CONV_EXCP', 'FALSE')]
Session  []*

As you can see, there's none information about UFT8 encoding and the session
info is empty. I also tried exporting the bash variable NLS_LANG inside the
code and directly in bash to .UTF8 (export
NLS_LANG=AMERICAN_AMERICA.AL32UTF8), but it didn't worked out.

When I try directly from the python interpreter, the result is different:

>>> c.execute('select * from 
>>> nls_database_parameters').fetchall()[('*NLS_NCHAR_CHARACTERSET',
'AL16UTF16')*, ('NLS_LANGUAGE', 'AMERICAN'), ('NLS_TERRITORY', 'AMERICA'),
('NLS_CURRENCY', '$'), ('NLS_ISO_CURRENCY', 'AMERICA'),
('NLS_NUMERIC_CHARACTERS', '.,'), ('*NLS_CHARACTERSET', 'AL32UTF8'*),
('NLS_CALENDAR', 'GREGORIAN'), ('NLS_DATE_FORMAT', 'DD-MON-RR'),
('NLS_DATE_LANGUAGE', 'AMERICAN'), ('NLS_SORT', 'BINARY'),
('NLS_TIME_FORMAT', 'HH.MI.SSXFF AM'), ('NLS_TIMESTAMP_FORMAT', 'DD-MON-RR
HH.MI.SSXFF AM'), ('NLS_TIME_TZ_FORMAT', 'HH.MI.SSXFF AM TZR'),
('NLS_TIMESTAMP_TZ_FORMAT', 'DD-MON-RR HH.MI.SSXFF AM TZR'),
('NLS_DUAL_CURRENCY', '$'), ('NLS_COMP', 'BINARY'), ('NLS_LENGTH_SEMANTICS',
'BYTE'), ('NLS_NCHAR_CONV_EXCP', 'FALSE'), ('NLS_RDBMS_VERSION',
'9.2.0.8.0')]

>>> c.execute('select * from nls_session_parameters').fetchall()
[('NLS_LANGUAGE', 'AMERICAN'), ('NLS_TERRITORY', 'AMERICA'),
('NLS_CURRENCY', '$'), ('NLS_ISO_CURRENCY', 'AMERICA'),
('NLS_NUMERIC_CHARACTERS', '.,'), ('NLS_CALENDAR', 'GREGORIAN'),
('NLS_DATE_FORMAT', 'DD-MON-RR'), ('NLS_DATE_LANGUAGE', 'AMERICAN'),
('NLS_SORT', 'BINARY'), ('NLS_TIME_FORMAT', 'HH.MI.SSXFF AM'),
('NLS_TIMESTAMP_FORMAT', 'DD-MON-RR HH.MI.SSXFF AM'), ('NLS_TIME_TZ_FORMAT',
'HH.MI.SSXFF AM TZR'), ('NLS_TIMESTAMP_TZ_FORMAT', 'DD-MON-RR HH.MI.SSXFF AM
TZR'), ('NLS_DUAL_CURRENCY', '$'), ('NLS_COMP', 'BINARY'),
('NLS_LENGTH_SEMANTICS', 'BYTE'), ('NLS_NCHAR_CONV_EXCP', 'FALSE')]

I checked
"/usr/lib/python2.4/site-packages/django/db/backends/oracle/base.py", and it
already have:
# Oracle takes client-side character set encoding from the environment.
os.environ['NLS_LANG'] = '.UTF8'

Any idea?

Thanks!
-- 
João Olavo Baião de Vasconcelos
Bacharel em Ciência da Computação
Analista de Sistemas - Infraestrutura
joaoolavo.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
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 
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