0

I have a real odd one... I'm outputting a table from a local MySQL database into a text file that has INSERT statements for each record (it's part of a much larger script and is the most efficient way to load data into an Aurora table). All is working well except for one bug-bear. The first insert adds odd characters in the very first field inserted, but no others. My insert statement: .\mysqldump.exe -h localhost -u $localuser --password=$localpass --default-character-set=utf8 --extended-insert=FALSE --add-drop-table abcdatabase exporttable | Out-File $dataoutfile The first insert statement saya "INSERT INTO exporttable VALUES ('13150',..." Any idea what those first three characters are and, more importantly, how I get rid of them? Thanks in advance

0

1 Answer 1

1

Ok, so I solved it with thanks to this post link near the bottom a comment by JBurace. I added -Encoding default to the end of the Out-File statement and the problem went away. Bizzare it was only one part of one field, but hey!

Sign up to request clarification or add additional context in comments.

1 Comment

It is a good practice to choose an encoding instead of default and to force it as the default might change when you upgrade the powershell. The "write-file" has a long history of messing up UTF-8-NoBOM encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.