-1

When I dump my databases using mysqldump in powershell the shell is producing a UTF-16 file.

How do I stop this behavior and have powershell produce a UTF-8 file (by default)?

Edit: creating a UTF-16 file is causing a "--binary-mode" problem when I try to reload it.

(I'm a powershell noob)

1 Answers1

4

How do I stop this behavior and have powershell produce a UTF-8 file (by default)?

$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'

The question is (As you aren't showing), how do you create a dump?

I assume you're doing it the following way:

mysqldump -parameter1 -parameterB > myFile.sql

Where it easily could be

mysqldump -parameter1 -parameterB | Out-File myFile.sql -Encoding utf8

Yes, it's more code to write, but it's not mandatory to change the default behavior.

Clijsters
  • 4,031
  • 1
  • 27
  • 37