Cosonok's IT Blog: When two Seemingly Identical CSV Files are Not!
When two Seemingly Identical CSV Files are Not!
I’m working on a PowerShell tool that needs to create CSV output, so I thought “if I create a standard text output with commas in, it will work.” It didn’t work first time and here’s why!
Open the file in bog-standard Notepad, go to File > Save As... and you’ll notice the current encoding is Unicode.
If you’re wondering what default is, right-click the desktop and create a new text file, then open up in Notepad and go to File > Save As... again, and you’ll notice the encoding is ANSI!
And this leads on to the title. When I copy and pasted the output generated by my script into a freshly created text file, it worked as a CSV, but the original didn’t work as a CSV (everything was in one column); using -Encoding Default we now have success!