Add PowerShell UTF-16 diff

This commit is contained in:
Anthony Rose 2023-04-17 13:04:07 +01:00
parent 2e164ec47e
commit d9eed9f0a7
3 changed files with 8 additions and 0 deletions

View file

@ -9,3 +9,5 @@
helper = manager helper = manager
[credential "https://dev.azure.com"] [credential "https://dev.azure.com"]
useHttpPath = true useHttpPath = true
[diff "utf16diff"]
textconv = "C:/Users/anthony.perkins/data/workstation/roles/home-cli/files/utf16diff.cmd"

View file

@ -0,0 +1,3 @@
@ECHO OFF
REM Add "*.ps1 diff=utf16diff" to ~/.config/git/attributes to use this.
powershell.exe -Command "%~dp0\utf16diff.ps1" "%1"

View file

@ -0,0 +1,3 @@
[string]$file = $args[0]
[string]$encoding = $(&"C:\Program Files\Git\usr\bin\file.exe" -b --mime-encoding $file)
&"C:\Program Files\Git\usr\bin\iconv.exe" -c -f $encoding -t UTF-8 $file