Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8mb4 character problem #73

Closed
seahindeniz opened this issue Jan 31, 2015 · 8 comments
Closed

utf8mb4 character problem #73

seahindeniz opened this issue Jan 31, 2015 · 8 comments

Comments

@seahindeniz
Copy link

I tried to dump this character properly but it allways return ? ? ?
🎭
🎲
🐈
My friend, can show me hot to solve this problem?

My DB sql
http://tny.cz/a17994ec

@ifsnop
Copy link
Owner

ifsnop commented Jan 31, 2015

Could you please create a dump with mysqldump, so i can reproduce the
problem?
El 31/01/2015 11:43, "traBolic" notifications@github.com escribió:

I tried to dump this character properly but it allways return ? ? ?
🎭
🎲
🐈
My friend, can show me hot to solve this problem?


Reply to this email directly or view it on GitHub
#73.

@seahindeniz
Copy link
Author

Of course http://tny.cz/d9db67e0

false)); $dump->start('ydk/'.time().'.sql'); ?>

@ifsnop
Copy link
Owner

ifsnop commented Jan 31, 2015

Thanks, but I was expecting to see the output from the original mysqldump
(the one that comes with mysql binaries). I imagine that maybe is not
possible, so I will try to reproduce the values. However, if you could
provide it, that would be great and reduce fix time.
El 31/01/2015 13:35, "traBolic" notifications@github.com escribió:

Of course http://tny.cz/d9db67e0

Reply to this email directly or view it on GitHub
#73 (comment).

@seahindeniz
Copy link
Author

Ok this is the original mysqldump result http://tny.cz/b3b2ad7a

using with "mysqldump -u root bagislar2 > c:/mysql.sql"

@seahindeniz
Copy link
Author

This is utf8mb4 original mysqldump
http://tny.cz/6f9d4477

"mysqldump --default-character-set=utf8mb4 -u root bagislar2 > c:/mysql.sql"

@seahindeniz
Copy link
Author

Problem solved by deleting this line https://github.com/ifsnop/mysqldump-php/blob/master/src/Ifsnop/Mysqldump/Mysqldump.php#L181

First, I change this line to $this->dbHandler->exec("SET NAMES utf8mb4"); and it worked
after do that, i delete the line for good.

Also

I changed the https://github.com/ifsnop/mysqldump-php/blob/master/src/Ifsnop/Mysqldump/Mysqldump.php#L223

$this->compressManager->write($this->getDumpFileHeader());
to
$this->compressManager->write(chr(239).chr(187).chr(191) .$this->getDumpFileHeader());

However i cant create sql file without bom signature but it worked so far(i believe)

And I know, this is not a global solution :)

@ifsnop ifsnop closed this as completed in 3e0c083 Feb 2, 2015
@ifsnop
Copy link
Owner

ifsnop commented Feb 2, 2015

I have added a new option to the dumpSettings array. You could now specify character encoding when connecting, just like mysql/mysqldump does with "default-character-set". When using "utf8mb4", there will be support for the four byte utf8 character encoding.

There is a new test that ensures that utf8mb4 columns are correctly dumped.

Please test this fix, as it could depend in configuration settings from my.cnf (it tries not to do so)

pd.- Until mysql sets the default connection mode to utf8mb4, mysqldump-php will use utf8.

@ifsnop
Copy link
Owner

ifsnop commented Feb 2, 2015

I prefer not to add the BOM signature since it is not needed for utf8 file reading, and won't fix the issue with database dumps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants