I'm not a native English speaker, and my English is poor.The following content is translated using gpt.
my database character setting
select * from v$nls_parameters where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET','NLS_NCHAR_CHARACTERSET');
NLS_LANGUAGE SIMPLIFIED CHINESE
NLS_TERRITORY CHINA
NLS_CHARACTERSET ZHS16GBK
NLS_NCHAR_CHARACTERSET AL16UTF16
When I try to insert a text into an NCLOB type field, I find that some Unicode characters, such as '\u00a0', are replaced with question marks "?".
I noticed that the setNonNullParameter method in NClobTypeHandler calls ps.setCharacterStream. I tried changing it to ps.setNCharacterStream, and the insert result was correct. I compared NClobTypeHandler and ClobTypeHandler, and they are the same. Why is this?
MyBatis version
3.5.6
Database vendor and version
DBMS: Oracle (ver. Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options) Case sensitivity: plain=upper, delimited=exact
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>23.4.0.24.05</version>
Comment From: harawata
Hello @Git-ruijing ,
Earlier versions had to support Java 1.5, so that probably was the reason (setNCharacterStream()
and getNClob()
was added in Java 1.6).
If you are keen, please send us a PR.