Pages

Monday, April 22, 2024

New Command Line Exe : Uniclip - Copy Unicode text to/from Windows clipboard

Uniclip is an executable that guarantees coping of Unicode text (UTF-8) to and from the Windows clipboard from the command line. It's an upgrade to the existing clip command with extra features including; word wrapping text (to fit the console window) and opening into Notepad (without using a file)! 

Conversion using Mozilla Universal Charset Detector to convert input to UTF-8. So CMD shell, piping, redirection will be converted now to UTF-8. UPDATE FOR Sat 15-Jun-24 

This is particularly useful on Windows 7, since in the command line (cmd.exe) the default code page is chcp1252 named 'West European Latin' Unicode code plane or ISO-8859-1, and conversion to UTF-8 must be handled correctly, or else you get non-printable characters.

 So, this will interpret input and convert output to UTF-8. In Windows 10+, the default cmd line (cmd.exe) code page is UTF-8, so no need to use the translation feature. But piped in files other than UTF-8, will be convert, which is handy. 

/fit  "word wrapping" is welcome on platforms, as well as the awesome opening in /notepad and /notepad++ switches!

This program's raison d'etre lies in the fact that there is still VERY limited support for Unicode in the CMD shell, piping, redirection and most commands are still ANSI only!

Run cmd.exe /U Causes the output of internal commands to a pipe or file to be in Unicode.


I built this utility for a project, if you want it free copy, email me at
.  This open source project is available here https://github.com/markpahulje/uniclip (updated Sat 15-Jun-24). 

Happy Earth Day, do some good. OceanHero - The search that saves the oceans

ReactOS: base/applications/cmdutils/clip/clip.c File Reference

BTW, Microsoft in partnership with IBM and in the spirit of open innovation, 
released the source code to MS-DOS 4.00 under the MIT license.  

UNICLIP v1.1.0615.611 Help (Free Version)

To install, unzip and copy uniclip.exe into C:\Windows\System32. 

DESCRIPTION

Copies and converts command line input text into UTF-8 'Unicode' and pastes it to the Windows clipboard. Conversion using Mozilla Universal Charset Detector to convert input to UTF-8. 


LIMITATIONS
There is still VERY limited support for Unicode in the CMD shell, piping, redirection and most commands are still ANSI only!
Run cmd.exe /U Causes the output of internal commands to a pipe or file to be in Unicode.

REQUIREMENTS
32-bit app which requires .NET Framework 4 Client Profile, so this can run on Win 7+.

SYNTAX
UNICLIP                     Dump contents
UNICLIP /h or /?         Help
UNICLIP /notepad      Open in Notepad
UNICLIP /fit                Word-wrap contents to fit current console window width

command | UNICLIP Copies contents of command to Windows clipboard via uniclip.
UNICLIP > command Copies contents of Windows clipboard into command via uniclip.


USAGE
uniclip

Writes the current Unicode text contents of the Windows clipboard to the console.

NOTE:
Default CMD.exe may not be set to display Unicode characters. To to display Unicode, change console code page using 'chcp 1200' Unicode for Win10+. Try 'chcp 65001' UTF-8 for Win 7+.
See https://learn.microsoft.com/en-us/dotnet/api/system.text.encodinginfo.getencoding?view=netframe
work-4.0

Also, you can run cmd.exe /U which causes the output of internal commands to a pipe or file to be
Unicode.


ARGUMENTS
No arguments recognized. All argument results in Help.

FLAGS
/h|/help Help
/notepad Opens Notepad with current clipboard contents
/fit Formats output to fit current console width

EXAMPLES

DIR | UNICLIP

Sends a Unicode directory listing to the clipboard.

UNICLIP < file.txt


Sends Unicode text file.txt onto the clipboard.

UNICLIP /fit

Writes the current Unicode text contents of the Windows clipboard to the console, word-wrapped to
current width of executing console. In image below, ipconfig /h is reformatted using /fit to fit narrow cmd window.




UNICLIP /notepad


Sends current clipboard (Unicode text) into a new instance of Notepad.

BONUS
No file used; CTRL-V message sent to Notepad instance directly. Title change in Notepad to reflect paste success.



COPYRIGHT © 2024 Mark Pahulje (https://github.com/markpahulje/uniclip) Win 7+, launch into Notepad,
reflow
Copyright © 2019 Aaron Meyers (https://github.com/bluemarsh/utf8clip) non-Win 7 compliant, not
working properly

LICENSE
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.






Update Fri 03-May-24: Pro version ($5.00USD) includes opening in Notepad++. Adding a new flag:
uniclip /notepad++ . I am charging that because it was so annoying to get done correctly. Built for Win10+, .NET 4.8. 
Email me at .

Pro Edition


No comments:

Post a Comment