Hi All,
On Oracle 10.2 with Character-Set set to WE8MSWIN1252,
When using Django, I try to select a Oracle row which contains a field with value as 'Páginas', i encounter the following error "'utf8' codec can't decode bytes "
Here is the trace from the python command prompt.
>>> tmlist = TerminologyMap.objects.filter(id=206)
>>> tmlist
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 68, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 83, in __len__
self._result_cache.extend(list(self._iter))
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 1-3: invalid data. You passed in 'P\xe1ginas' (<type 'str'>)
>>> tmlist
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 68, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 83, in __len__
self._result_cache.extend(list(self._iter))
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 1-3: invalid data. You passed in 'P\xe1ginas' (<type 'str'>)
Please let me know if I am doing something wrong here or if there is already a solution available for this encoding problem.
Regards,
Anurag
-- 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment