public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Миронов Леонид Владимирович" <lv.mironov@severstal.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: getclip and putclip garble unicode characters
Date: Fri, 25 Jun 2021 09:00:09 +0000	[thread overview]
Message-ID: <c7597576edad43a1ae1a8a37ab47bd62@severstal.com> (raw)
In-Reply-To: <1442655532.20210624093554@yandex.ru>

As far as copying from cygwin to windows is concerned, it happens in exactly the same way in all windows programs I tried pasting data to - word, outlook, chrome, console, you name it. Changing windows keyboard language has no effect either, windows still stubbornly treats clipboard contents as cp1252 (don't quite see how it is supposed to help - data on the clipboard is not limited to one single-byte codepage anyway). 

At first I missed that when copying from windows to cygwin getclip actually gets data in cp1251 (windows ANSI codepage), thus cyrillic characters can be at least recovered with iconv, but non-cyrillic non-latin characters - e.g. greek, are replaced with question marks and are lost although in windows everything can be pasted back without issues, again regardless of the program and keyboard language.

So in a nutshell, when copy-pasting from cygwin putclip to windows unicode is treated as cp1252 while copy-pasting from windows to cygwin getclip unicode is treated as cp1251.

Sorry for top-posting.

-----Original Message-----
From: Andrey Repin <anrdaemon@yandex.ru> 
Sent: Thursday, June 24, 2021 9:36 AM
To: Миронов Леонид Владимирович <lv.mironov@severstal.com>; cygwin@cygwin.com
Subject: Re: getclip and putclip garble unicode characters

Greetings, Миронов Леонид Владимирович!

> getclip and putclip from cygutils-extra garble unicode characters:
> non-latin characters copied to clipboard in windows are replaced with 
> question marks when retrieved with getclip in cygwin, and non-latin 
> characters copied to clipboard using putclip are pasted it in windows 
> looking like utf-8 displayed in cp1252 but can be retrieved with 
> getclip exactly as pasted, so it looks like the problem is not in the 
> way the data is copied but in the way cygwin and windows communicate 
> text encoding to each other. LC_CTYPE=en_US.UTF-8, windows ANSI codepage is set to cp1251 - 1251, not 1252.

This looks like you are using a program incapable of dealing with unicode clipboard. To achieve better results, switch your input language/keyboard to matching language before copying text from application. I.e. switch to Russian then copy text, then check what is returned by getclip.
But then, why LC_CTYPE is en_US?


--
With best regards,
Andrey Repin
Thursday, June 24, 2021 9:33:54

Sorry for my terrible english...

  reply	other threads:[~2021-06-25  9:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 13:45 Миронов Леонид Владимирович
2021-06-23 22:27 ` Mark Geisert
2021-07-05 10:04   ` Mark Geisert
2021-06-24  6:35 ` Andrey Repin
2021-06-25  9:00   ` Миронов Леонид Владимирович [this message]
2021-06-25 18:01   ` Thomas Wolff
2021-06-25 18:54     ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7597576edad43a1ae1a8a37ab47bd62@severstal.com \
    --to=lv.mironov@severstal.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).