Embarcadero / IB.NETDataProvider

InterBase database .NET Data Provider
Other
12 stars 7 forks source link

Get UNICODE_LE charset actual value #8

Closed tramesh2009 closed 1 year ago

tramesh2009 commented 2 years ago

Hi,

We've Multilanguage requirement in our application. To support this in Interbase Database table field We've specified the Data type as Varchar(400) Charset as UNICODE_LE.

We saved Chineese Character in this field When we try fetch it is not returning chineese format It returns in Different format.

Thank you Rameshkumar T

jeffovercash commented 2 years ago

Are you setting the character set in the connection string? While the original Fb code did not have any unit tests around this, I did look at the code and it should be translating back and forth. I'll be writing some unit tests, but I know with IBX and FireDAC to work with non-ANSI data you need to set the lc_ctype in hte connection string and with the ADO>NET driver that is the character set parameter.

tramesh2009 commented 2 years ago

Hi, We got the solution to save and retrieve unicode value by using this driver. The following steps we are used to achieve this concept Field Name : Unicode_text Data Type : Varchar(400) Charset : Unicode_LE

Retrieve Concepts: byte[] bytes = Encoding.Default.GetBytes(<DB Field Name>); var fieldValue = Encoding.UTF8.GetString(bytes);

Save Concepts: byte[] byteValue = Encoding.UTF8.GetBytes(actualValue); fieldValue =Encoding.Default.GetString(byteValue);

We should add charset=UTF8 in the connection string for this table fetch and save

Thank You

jeffovercash commented 2 years ago

7.12.1 release goes back to the way most drivers work and that is no charset is none, not UTF8 (the API is none if the lc_ctype is not set). So with the no charset being set tramesh2009's workaround should not be needed.