Quantcast
Channel: SCN: Message List - SAP SQL Anywhere
Viewing all articles
Browse latest Browse all 2182

Re: unicode not working in nvarchar column

$
0
0

Hi Alex,


>> I need to, to nvarchar to support UTF-8, do char columns need to be converted to UTF-8 as well?

 

Not necessarily - but it depends on how you are planning to insert the data into the NVARCHAR columns.

 

See: http://dcx.sap.com/index.html#sqla170/en/html/814817656ce21014adbcaaa8dda46684.html

 

     >> Character set conversion causes all SQL statements to be converted to the database character set before parsing and execution.

 

So this means if you use a direct SQL statement:

 

     INSERT INTO t1 (nvarchar1) VALUES ('<data>')

 

we will always interpret <data> in the character set of the database. Unless the default character set is changed to UTF-8 as Jinwoo indicated, you will get character set conversion. You will need to rebuild your database to change the default encoding to UTF-8.

 

However, if you use a prepared statement with a bound parameter (something you can't do in Interactive SQL):

 

See: http://dcx.sap.com/index.html#sqla170/en/html/3bd40bc26c5f1014a2c5d100ae5b773e.html

 

     INSERT INTO t1 (nvarchar1) VALUES (?)

 

you can then directly bind UTF-8 data to that statement, and we will insert the UTF-8 data directly without translation.

 

Best regards,

 

- Jeff


Viewing all articles
Browse latest Browse all 2182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>