By default, PowerShell ISE uses a 16-bit Unicode text encoding, if you let it create your script. Mercurial, specifically TortoiseHg, says a file is binary if it contains any NUL bytes.
ASCII-compatible text, encoded as UTF-16, or a variant thereof, will contain *plenty* of NUL bytes for Mercurial to find, thus you can’t see diffs for scripts you create with Powershell ISE in your Commit window.
To create UTF-8 versions of your scripts, you can run:
1 | gci -recurse -include *.ps1,*.psm1 | %{$foo = gc $_; $foo | out-file -en utf8 $_} |
Of course, if you actually *need* UTF-16 characters in your scripts/modules, this would be a Bad Idea.
Other workarounds include using a different text editor to create your script, then edit in Powershell ISE.
No user commented in " TIL: Powershell ISE, Text Encoding, and Mercurial. "
Follow-up comment rss or Leave a TrackbackLeave A Reply