MyDump produces UTF16 files.

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ereimers
Posts: 4
Joined: Fri 24 May 2019 09:23

MyDump produces UTF16 files.

Post by ereimers » Fri 24 May 2019 09:41

Hi,

I am using the following code to produce a dump of a database:

MyDump.Connection.Close;
MyDump.Connection.Options.UseUnicode := False;
MyDump.Connection.Options.Charset := 'utf8';
MyDump.Connection.Open;
MyDump.BackupToFile('C:\test\test.dump');

Unfortunately the resulting file is stored in UTF16 coding. This is not readable by the MySQL workbench we are using. After rewriting the file to UTF8 all is fine.
Why does this happen on some Systems, although we are saying to use UTF8 ?

We are using Delphi 10.1.2 (Berlin) and MyDac 8.7.23

Regards
Erik

ViktorV
Devart Team
Posts: 2762
Joined: Wed 30 Jul 2014 07:16

Re: MyDump produces UTF16 files.

Post by ViktorV » Mon 27 May 2019 09:30

In your case, the file will be created with UTF-8 BOM encoding rather than UTF-16. MySQL Workbench may work incorrectly with UTF-8 BOM encoding, e.g. there's a known bug (https://bugs.mysql.com/bug.php?id=95415). To solve your issue, you can convert the resulting file to UTF-8 without BOM encoding.

ereimers
Posts: 4
Joined: Fri 24 May 2019 09:23

Re: MyDump produces UTF16 files.

Post by ereimers » Thu 06 Jun 2019 05:15

Hi Viktor,

I checked the output files and I am very sure that these are UTF16 !
I could send you an extract of the first bytes of an dump file.

How can I convert the files ?
Using an external App ?

Regards
Erik

ViktorV
Devart Team
Posts: 2762
Joined: Wed 30 Jul 2014 07:16

Re: MyDump produces UTF16 files.

Post by ViktorV » Thu 06 Jun 2019 12:58

To solve your issue please try to use the following guidelines:
- open your dump file in Notepad ++;
- check encoding using the menu Encoding;
- change the encoding to UTF-8 using the menu Encoding;
- save your dump file;
- try the restore operation again.
If you have any questions after reading our answer - please contact us and we will try to give you a detailed answer in the shortly.

ereimers
Posts: 4
Joined: Fri 24 May 2019 09:23

Re: MyDump produces UTF16 files.

Post by ereimers » Fri 26 Jul 2019 08:29

Hi Viktor,

yes I know that the files could be converted. But these are really giantly big. Some have several GB. So that our customers can´t convert it themselves.

Menu Encoding in Notepad++ is showing "UCS-2 LE-BOM".
So why is MyDump producing this kind of encoding ?

Regards
Erik

Stellar
Devart Team
Posts: 310
Joined: Tue 03 Oct 2017 11:00

Re: MyDump produces UTF16 files.

Post by Stellar » Thu 01 Aug 2019 13:24

Unfortunately, we can't reproduce the issue. To investigate this behavior of MyDAC, please compose a small sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

ereimers
Posts: 4
Joined: Fri 24 May 2019 09:23

Re: MyDump produces UTF16 files.

Post by ereimers » Wed 21 Aug 2019 06:46

I can´t send you an example Database. Problem only persists on systems of our customers. Nobody would be willing to export their data to you.
I could send you an extract of a dump showing the problem. The dump itself is 1 GB in size.
All these dumps are big in size. Maybe that´s the problem ?

Regards

ViktorV
Devart Team
Posts: 2762
Joined: Wed 30 Jul 2014 07:16

Re: MyDump produces UTF16 files.

Post by ViktorV » Thu 22 Aug 2019 14:55

Please place it on free filehosting and send us the link using the contact form https://www.devart.com/company/contactform.html

Post Reply