Hopefully for you this would be trivial to answer.
I have gvim and vim on Win7. Any time I redirect command result to file and open it with Vim (or Gvim, same effect) I have binary 0 (^@ sign) inserted between every characters.
So, instead of
r96130
I have
^@r^@9^@6^@1^@3^@0^@
Any idea how to (preferred) prevent it or (fine) get rid of it?
I tried substitution but obviously this ain't just ^@, it's a binary zero (I think) so it's not picked up on /^@
.
Edit(s):
1) Tried setting encoding to UTF-8 (encoding of content I am working on) and UTF-16 (per @Philippe Wendler's answer, thank you), to no avail.
2) __PowerShell__ is the guilty party. When I do the redirection on usual command line (via cmd
) then there are no side-effects. Only files created on PowerShell sessions have these binary zeroes inserted.
3) Powershell goodies that @Christian mentioned didn't help. I'll leave the question unanswered as I've switched to Ubuntu as my main OS and use Vim there, so the only 'solution' here is now not to use PowerShell + Vim, which obviously is lacking as an answer. :-)
Solution!
Thanks @Emperor XLII for a solution! Posting here as it was in a comment so might not be visible enough:
dir | OutFile -Encoding UTF8 test
creates a file that appears in Vim without binary zeroes. Same happens if I run with Encoding to OEM, ASCII, and two others I've tested.
A promising tip lies in :he 'fileencodings'
- yes, plural, by @Dan Fitch, but I haven't tested it as I aready moved away from Win7 by that time.