Thanks for the heads up, I didn't know about unicode problems in clip.exe. Do you have a link?
Set-Clipboard exists in full Windows Powershell, but not in Powershell "core" (open source version). I also didn't find a clipboard API in the current .NET core. So I went with native tools for now, and clip.exe is the only built-in option for Windows. If/when there is better xplat clipboard support in .NET or Powershell core I'll definitely move to that. Another option would be to check if Set-Clipboard exists and use it if so.
Sorry, it's not clip that has problems with Unicode, but rather PowerShell when piping to native commands. I should have remembered that fact.
One can set $OutputEncoding to UTF16LE to make things work. In that case, clip has no problems with Unicode, but by default PowerShell will use CP1252 when piping data to native programs. Maybe the variable can be set differently only for your module.
Comments
Didn't clip have trouble with Unicode? There should be Set-Clipboard now, too (unless I got that from pscx or similar).
Thanks for the heads up, I didn't know about unicode problems in clip.exe. Do you have a link?
Set-Clipboard exists in full Windows Powershell, but not in Powershell "core" (open source version). I also didn't find a clipboard API in the current .NET core. So I went with native tools for now, and clip.exe is the only built-in option for Windows. If/when there is better xplat clipboard support in .NET or Powershell core I'll definitely move to that. Another option would be to check if Set-Clipboard exists and use it if so.
Sorry, it's not clip that has problems with Unicode, but rather PowerShell when piping to native commands. I should have remembered that fact.
One can set $OutputEncoding to UTF16LE to make things work. In that case, clip has no problems with Unicode, but by default PowerShell will use CP1252 when piping data to native programs. Maybe the variable can be set differently only for your module.