cyd01 / KiTTY

:computer: KiTTY, a free telnet/ssh client for Windows
https://www.9bis.com/kitty
Other
1.61k stars 136 forks source link

multi-byte utf-8 output sent to ansi printer to clipboard produces garbage #494

Open mgrant0 opened 1 year ago

mgrant0 commented 1 year ago

Set up KiTTY to send stdout to ansi printer as per http://www.9bis.net/kitty/index.html#!pages/StdoutToClipboard.md

Create the bash function as directed:

% function wcl {
  echo -ne '\e''[5i'
  cat $*
  echo -ne '\e''[4i'
  echo "Copied to Windows clipboard" 1>&2
}
% echo £500 | wcl
Copied to Windows clipboard

This is what I get when I paste into notepad:

£500

€100 pastes as €100

I tried piping the cat to iconv to convert it to something else like utf-16 but it's even worse. I tried several (definitely not all!) different encodings in iconv but I couldn't find one which was clean.

Any idea if this is an encoding issue?