Unicode - UTF-16 or UTF-8?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
ulebule
Posts: 3
Joined: Wed 27 Sep 2006 12:57

Unicode - UTF-16 or UTF-8?

Post by ulebule » Wed 27 Sep 2006 13:10

We plan to use OraDirect in the Unicode-mode for the next version of our software. Now I'm checking what we have to modify in the DB-instance and in our code to fully support unicode.
I've read that OraDirect uses UTF-16 when we set Unicode=true in the connect string.
When I create a new database instance, I can configure Oracle only to use AL32UTF8 as Database Character Set. There doesn't seem to exist a way to configure it to use UTF16.
So, is there a problem if OraDirect uses UTF-16 and Oracle uses UTF-8?

Thank you very much for your help!
Best regards,
Tom

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Wed 27 Sep 2006 14:07

There is no way to define UTF-16 charset for database using Oracle client wizards. In .NET application you will get conversion from UTF-16 to UTF8 or any national charset.
You can avoid string conversion if you use UTF-16 charset for NCHAR, NVARCHAR fields.
Unicode mode in OraDirect .NET turns on ability of Oracle client to send SQL texts and parameter values in UTF-16 charset. Oracle converts these UTF-16 values to UTF8 for UTF8 database.

ulebule
Posts: 3
Joined: Wed 27 Sep 2006 12:57

Post by ulebule » Wed 27 Sep 2006 14:19

So, there is no problem when we access a VARCHAR field. OraDirect or Oracle automatically converts the data to UTF-8, right?

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Wed 27 Sep 2006 14:31

Yes, there is no problem.
In Unicode=true the conversion is from UTF-8 to UTF-16 by Oracle server.
In Unicode=false the conversion is from UTF-8 to by Oracle server and
from to UTF-16 by OraDirect .Net

ulebule
Posts: 3
Joined: Wed 27 Sep 2006 12:57

Post by ulebule » Wed 27 Sep 2006 14:37

These are good news!
Thank you for your support.

Best regards,
Tom

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 28 Sep 2006 05:55

You are welcome.

Post Reply