Charset problem using TUniDump

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
alexdmatveev
Posts: 9
Joined: Mon 04 Nov 2013 18:46

Charset problem using TUniDump

Post by alexdmatveev » Mon 06 Feb 2017 12:01

Hello collegues,

I have an old problem that was discussed several times at the forum.
In any case I can not find appropriate solution that works for me.

I have a database at MySQL Server.

Code: Select all

SHOW VARIABLES LIKE 'ver%'

"Variable_name"	"Value"
"version"	"5.5.34"
"version_comment"	"MySQL Community Server (GPL)"
"version_compile_machine"	"x86"
"version_compile_os"	"Win64"

Code: Select all

SHOW VARIABLES LIKE 'char%'

"Variable_name"	"Value"
"character_set_client"	"utf8"
"character_set_connection"	"utf8"
"character_set_database"	"utf8"
"character_set_filesystem"	"binary"
"character_set_results"	"utf8"
"character_set_server"	"utf8"
"character_set_system"	"utf8"

Code: Select all

Database charset: utf8
Database collation: utf8_general_ci
Inside of the database I have some tables...
Here I have some strange points (do not ask me why it is so... My customer owns the database).

Code: Select all

Tablename: kunden

Charset = latin1
Collation = latin1_swedish_ci

Then in my win32 application in Delphi XE7 I have TUniConnection.

Code: Select all

SpecificOptions['UseUnicode'] = True
SpecificOptions['Charset'] = utf8
I tryed also:

Code: Select all

SpecificOptions['Charset'] = auto
Then I have TUniDumpComponent and execute:

Code: Select all

FDump.BackupToFile(filename);
What I have is nice and correct UTF8 file with all umlauts and other correct chars.

As next step I need to restore new database from this backup.
I create a database with the same settings on the same server and execute:

Code: Select all

FDump.RestoreFromFile(filename);


Database is restored without any error exceptions but on places of umplauts I have question marks "?".

It is absolutely clear for me that I have a problem in my settings.

But please show me my mistake.

Thanks a lot for advance.

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

Re: Charset problem using TUniDump

Post by ViktorV » Mon 06 Feb 2017 12:57

To execute backup correctly, please set the TUniConnection.Options.UseUnicode property to False when executing backup/data restore operations.

alexdmatveev
Posts: 9
Joined: Mon 04 Nov 2013 18:46

Re: Charset problem using TUniDump

Post by alexdmatveev » Mon 06 Feb 2017 13:11

Brilliant, thanks a lot.

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

Re: Charset problem using TUniDump

Post by ViktorV » Mon 06 Feb 2017 13:22

Thank you for your interest to our product.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.

Post Reply