Page 1 of 1

Charset problem using TUniDump

Posted: Mon 06 Feb 2017 12:01
by alexdmatveev
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.

Re: Charset problem using TUniDump

Posted: Mon 06 Feb 2017 12:57
by ViktorV
To execute backup correctly, please set the TUniConnection.Options.UseUnicode property to False when executing backup/data restore operations.

Re: Charset problem using TUniDump

Posted: Mon 06 Feb 2017 13:11
by alexdmatveev
Brilliant, thanks a lot.

Re: Charset problem using TUniDump

Posted: Mon 06 Feb 2017 13:22
by ViktorV
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.