0

I am trying to save chinese character into oracle DB using Nhibernate thru C# and the character saved always end up with some rubbish character.

I have done the following:

  1. Hbm mapping for the field is declared as type AnsiString and column type as sql-type="nvarchar". Have also tried String and nvarchar2 too.
  2. Database column data type is NVARCHAR2.
  3. Registry, environment variable and database charset NLS_LANG is set to UTF8.

I am able to read the chinese character input thru sql developer. But when I try to retrieve them (the character display correctly on screen) and attempt to save them back into the database without any changes, the data saved became "�����".

Anyone have any clue what have I miss out here?

1 Answer 1

1

I would check what the data really is on the .NET side. Don't trust what's displayed on a console - look at the UTF-16 code points.

See my debugging unicode article for the general approach.

I seem to remember having some problems in Oracle before which were only fixed by setting the database encoding and then rebuilding the database - I couldn't apply it to an existing one. However, the details are in the dim and distant past...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.