title: Can't get git to play nice with iconv and utf-16
body: <p>I'm trying to get git to recognize UTF-16 as text to allow me to diff and patch as text natively, but I'm having trouble getting the <code>textconv</code> parameter to work.</p>
  
  <p>I can manually call </p>
  
  <pre><code>iconv -f utf-16 -t utf-8 some-utf-16-file.rc
  </code></pre>
  
  <p>and everything is fine. But if I configure my .gitconfig as follows</p>
  
  <pre><code>[diff "utf16"]
      textconv = "iconv -f utf-16le -t utf-8"
  </code></pre>
  
  <p>and my .gitattributes:</p>
  
  <pre><code># Custom for MFC
  *.rc text eol=crlf diff=utf16
  </code></pre>
  
  <p>However, if I then if I run <code>git diff</code>, the following is displayed:</p>
  
  <pre><code>iconv: C:/Users/Mahmoud/AppData/Local/Temp/IjLBZ8_OemKey.rc:104:1: incomplete character or shift sequence
  </code></pre>
  
  <p>With procmon I was able to track it down as creating this process:</p>
  
  <pre><code>sh -c "iconv.exe -f utf-16le -t utf-8 \"$@\"" "iconv.exe -f utf-16le -t utf-8" C:/Users/Mahmoud/AppData/Local/Temp/JLOkVa_OemKey.rc
  </code></pre>
  
  <p>...which I can actually run fine (on the actual file, though).</p>
  
  <p>Any ideas?</p>
  
  <p>(Please note that I'm aware of the various solutions for getting git to work with UTF-16. I'm specifically trying to address this question of why iconv by itself works but it will not work when called by git. Also, this error was originally encountered while trying one of the linked solutions from the "duplicate" question. Thank you all kindly.)</p>