Opened 5 years ago

Closed 5 years ago

#30954 closed Bug (wontfix)

NVARCHAR2 fields are not using cx_Oracle.NCHAR.

Reported by: Jaume Moral Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: oracle charset
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When inserting or updating NVHARCHAR2 fields and we need to store special char in a parameter "x" we need to use


I found this is this discussion

As far as I know, this is not implemented in Oracle backend. In OracleParam class, input_size is used with some data types (TIMESTAMP, CLOB...) but not for NCHAR. I tried to patch it forcing NCHAR in every string, but I'm sure this is not the best way to do it.

We can see this bug in an Oracle DB with ISO8859 charset, when using models with CharField (that maps to NVARCHAR2) and with any non-iso8859 character (for example, "ć"). Without the patch, this special chars turn into "¿" in database.

Change History (1)

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: wontfix
Status: newclosed
Summary: NVARCHAR2 fields are not using cx_Oracle.NCHARNVARCHAR2 fields are not using cx_Oracle.NCHAR.
Version: 2.2master

Django supports only databases that use UTF-8 encoding (see documentation). Using cx_Oracle.NCHAR will not fix your issue because connection.nencoding is set to UTF-8.

Note: See TracTickets for help on using tickets.
Back to Top