Changes between Version 1 and Version 2 of Ticket #11487, comment 23
- Timestamp:
- Mar 3, 2011, 1:55:50 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #11487, comment 23
v1 v2 7 7 8 8 9 causes the following error when inserting more than 4000 characters .9 causes the following error when inserting more than 4000 characters (I'm trying to add a new flatpage): 10 10 11 11 12 12 {{{ 13 DatabaseError: ORA-12704: character set mismatch 13 DatabaseError at /admin/flatpages/flatpage/1/ 14 ORA-12704: character set mismatch 14 15 }}} 15 16 17 I've tried to change the string in oracle/base.py (self.input_size = Database.CLOB) to LONG_STRING and NCLOB. All three variants produce errors. I'm struggling with the issue for several days, so I've tested on various cx_Oracle versions. 16 18 17 Changing it to19 I've made tests on three cx_Oracle versions: 4.4.1, 5.0.4 and 5.0.4 with WITH_UNICODE compilation flag. 18 20 21 I've made tests on two strings: cyrillic string of length 10350 symbols (the string can be found on http://dumpz.org/37744/text/) and a simple latin string of 16004 symbols "a". 19 22 23 During the tests, I was getting three types of errors: 24 25 1. (hieroglyphs) The text is being saved without errors, but it is displayed as hieroglyphs (e.g. 慡) 26 2. (mismatch) The text is not saved, and the following error is returned: 20 27 {{{ 21 self.input_size = Database.LONG_STRING 28 DatabaseError at /admin/flatpages/flatpage/1/ 29 ORA-12704: character set mismatch 30 }}} 31 3. (!UnicodeDecodeError) The text is saved, but when trying to display it, an exception is raised: 32 {{{ 33 UnicodeDecodeError at /admin/flatpages/flatpage/1/ 34 'utf16' codec can't decode bytes in position 44-45: illegal encoding 22 35 }}} 23 36 37 The distribution of types of errors is the following: 24 38 25 (as initially suggested by the reporter) works ok. 39 1. Cyrillic string: 40 1.1. cx_Oracle 4.4.1. 41 CLOB: mismatch, 42 LONG_STRING: hieroglyphs, 43 NCLOB: hieroglyphs. 26 44 27 I've attached the patch and a test case that fails with CLOB. 45 1.2. cx_Oracle 5.0.4. 46 CLOB: mismatch, 47 LONG_STRING: !UnicodeDecodeError, 48 NCLOB: !UnicodeDecodeError. 28 49 29 I'm using cx_Oracle version 5.0.4 with unicode support, Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production and Django development version. 50 1.3. cx_Oracle 5.0.4 + WITH_UNICODE. 51 CLOB: mismatch, 52 LONG_STRING: !UnicodeDecodeError, 53 NCLOB: mismatch. 54 55 2. Latin string: 56 2.1. cx_Oracle 4.4.1. 57 CLOB: mismatch, 58 LONG_STRING: hieroglyphs, 59 NCLOB: hieroglyphs. 60 61 2.2. cx_Oracle 5.0.4. 62 CLOB: mismatch, 63 LONG_STRING: hieroglyphs, 64 NCLOB: hieroglyphs. 65 66 2.3. cx_Oracle 5.0.4 + WITH_UNICODE. 67 CLOB: mismatch, 68 LONG_STRING: hieroglyphs, 69 NCLOB: mismatch. 70 71 I'm using Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production and Django development version.