delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/07/05/06:04:51

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72A80385800E
Authentication-Results: sourceware.org;
dmarc=none (p=none dis=none) header.from=maxrnd.com
Authentication-Results: sourceware.org; spf=none smtp.mailfrom=maxrnd.com
Subject: Re: getclip and putclip garble unicode characters
From: Mark Geisert <mark AT maxrnd DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
References: <af6d2888db8e4256b8c24064389aed9b AT severstal DOT com>
<aa30862d-086e-752f-26f3-0522c7c08b45 AT maxrnd DOT com>
Message-ID: <f787f17c-c410-6b80-fc4f-490b86dad3ce@maxrnd.com>
Date: Mon, 5 Jul 2021 03:04:21 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Firefox/52.0 SeaMonkey/2.49.4
MIME-Version: 1.0
In-Reply-To: <aa30862d-086e-752f-26f3-0522c7c08b45@maxrnd.com>
X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, SPF_HELO_NONE,
SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 165A4orV018901

Replying to myself...

Mark Geisert wrote:
> Hi Leonid (?),
> 
> Миронов Леонид Владимирович via Cygwin wrote:
>> 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.
> 
> Thanks for the report.  I will investigate.

I believe I have a local testcase similar to your report: If I select a region of 
text on a message displayed from the Cygwin mailing list digest, and that message 
has Cyrillic characters in it, getclip replaces those characters with '?' on output.

Since Thomas suggested an alternative, using 'cat < /dev/clipboard', I tried that 
as well and see that here UTF-8 is output and the Cyrillic characters are intact.

So I've modified getclip to understand what MS calls CF_UNICODETEXT from the 
clipboard and have it converted to UTF-8 for output.  Thus my new getclip can 
duplicate what the alternative does.  (What getclip could understand previously 
was CF_TEXT ("normal" ANSI characters) or CYGWIN_NATIVE (an internal Cygwin format 
that makes your putclip + getclip example work)).

How about I generate a test version of the cygutils package with this updated 
getclip and you can see if it solves your issue?
Stay tuned,

..mark

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019