Posts

Showing posts with the label Encoding

Weird Spaces Between Characters in PowerShell Output

Have you ever redirected output from PowerShell into a file, only to find that there are spaces between every character?  Have you ever redirected output from PowerShell into a config file that the program just absolutely refuses to read in, even through it looks exactly the same as a known-good config file?  If so, you probably have encoding issues.  The good news?  They're really easy to fix, once you know what's going on. So, by default that nice ">" output redirect uses Unicode.  Most of the time, that works just fine... but sometimes, especially if you're working with legacy software, it's going to cause you problems.  Here's a TechNet article on the issue .  Let's take a quick look at some examples - run this command in PowerShell to generate an example file: echo "Hello World" > test.txt Then open up test.txt in Notepad, hit "Save As" and look at the bottom of the window.  There's an "Encoding" secti...