Skip to Content
0
Jun 06, 2022 at 07:08 PM

Chinese simplified - cast from Char to NChar

322 Views

Hi,

my problem: We have a tool (Delphi 5 + old ADS database version that did not know NChar or NVarChar), and a new tool developed with Delphi Tokyo and ADS 12.

Chinese text has always be stored in CHAR datatype in ADS, which did not create any problems. Chinese text could be displayed properly. I can't use NChar or NVArChar because the old tool would not be able to open *.adt files with unknown datatype.

Internally it seems that ADS treats for example 是 as ÊÇ

This is the result of Select Cast(Name as SQL_WVARCHAR) from test

where 'Name' is Char(255) and stores 是

All my problems I am facing right now would be solved if I am able to program a Delphi function (Delphi Tokyo) like:

function GetCastResult(s: string): string;

where s:=是

result:=ÊÇ

I hope that anybody can help me, thank you in advance