Different (unicode) format in database between Delphi 7 and Delphi Rad Studio
Posted: Fri 09 Aug 2019 12:05
Hi,
I have my application compiled in Delphi 7 using MyDAC. When I export the database to XML, with something like:
I get the following XML information for a column field defined as "info TEXT CHARACTER SET utf8".
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:
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!
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;
Code: Select all
...
<rs:data>
<z:row ID_Order='1' info='T<0x00>e<0x00>s<0x00>t<0x00>'
...
...
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'
...
...
I want to reuse my old database (exported in XML from Delphi 7) with my new application (compiled with Delphi 10.x)
Thanks!