Page 1 of 1

Different (unicode) format in database between Delphi 7 and Delphi Rad Studio

Posted: Fri 09 Aug 2019 12:05
by rahucha
Hi,

I have my application compiled in Delphi 7 using MyDAC. When I export the database to XML, with something like:

Code: Select all

procedure TableToXML(XMLFileName: String);
var
  TempQuery: TMyQuery;
begin
  Database_CreateQuery(TempQuery);

  with TempQuery do
  begin
    Options.EnableBoolean := False;
    SQL.Clear;
    SQL.Add(Format('SELECT * FROM %s', [TB_CUSTOMERS]));
    Open;

    TempQuery.SaveToXML(XMLFileName);
    Free;
  end;
end;
I get the following XML information for a column field defined as "info TEXT CHARACTER SET utf8".

Code: Select all

...
<rs:data>
    <z:row ID_Order='1' info='T<0x00>e<0x00>s<0x00>t<0x00>'
   ...
...
As you can see there are like "NULL" terminators after each char.

The problem is when I compile my application for Delphi Rad Studio 10.x and import the XML. The "<0x00>" is recognised as a NULL terminated string and I just get "T" from the above example.

When I use the same code on Delphi 10.x and export to XML, the result is:

Code: Select all

...
<rs:data>
    <z:row ID_Order='1' info='Test'
   ...
...
So, for Delphi 7 (which is not UNICODE) you seem to do some "magic" on the exported XML file. Is there any way to remove those "0x00" to make it compatible with latest versions of Delphi?

I want to reuse my old database (exported in XML from Delphi 7) with my new application (compiled with Delphi 10.x)

Thanks!

Re: Different (unicode) format in database between Delphi 7 and Delphi Rad Studio

Posted: Fri 16 Aug 2019 14:13
by ViktorV
Unfortunately, we cannot reproduce the problem in our environment based on the data you provide.
Please, try to compile and send us using the contact form https://devart.com/company/contactform.html an example of a reproducing error, including scripts for creating and populating database objects.
Also, please specify the UniDAC version you are using.