Replacement for clip.exe in Windows that supports both read from/write to clipboard and uses UTF-8 encoding by default.
Works well with PowerShell Core or console programs that explicitly output UTF-8 text.
utf8clip is published as a .NET Core Global Tool so you can install it directly from the command line:
dotnet tool install --global utf8clip
You can also download utf8clip and manually copy it to a directory in your PATH.
.NET Core 3.0 or later runtime is required.
If started with file/piped input:
- Copies the input, interpreted as UTF-8 text†, to the Windows clipboard.
Otherwise:
- Prints the contents of the Windows clipboard to output as UTF-8 text.
†If there is a byte-order mark in the input it will be respected, e.g. for UTF-16 encoded files.
<program> | utf8clip
Places a copy of the UTF-8 output from on to the Windows clipboard.
Note that most native Windows commands like dir do not write UTF-8 output unless the console codepage is changed with chcp.
utf8clip < README.md
Places a copy of the text from README.md on to the Windows clipboard.
utf8clip
Writes the current contents of the Windows clipboard to the console.
ls | utf8clip
Places a copy of the current directory listing on to the Windows clipboard.
This works correctly as PowerShell Core uses UTF-8 output by default.
cat .\README.md | utf8clip
Places a copy of the text from README.md on to the Windows clipboard.
utf8clip
Writes the current contents of the Windows clipboard to the console.