From: Kris Maglione <bsdaemon@comcast.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Mac p9p snarf buffer
Date: Thu, 3 May 2007 18:55:49 -0400 [thread overview]
Message-ID: <20070503225549.GA62050@kris.home> (raw)
In-Reply-To: <7359f0490705031052x3a2d8155x1cab9d4dafa405d4@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]
On Thu, May 03, 2007 at 10:52:26AM -0700, Rob Pike wrote:
> The snarf issue that bothers me most these days is that the
> plan9port programs, at least on the mac, don't handle UTF-8
> in the snarf buffer correctly. UTF-8 going out turns into junk;
> going in it turns into question marks.
Yes, this bothered the hell out of me, too. I fixed my copy of
devdraw(1) to ask for a UTF8_STRING before a STRING, as suggested by the
comment, which seems to imply that the extra polling is not worth the
effort:
* We should try to go for _x.utf8string instead of XA_STRING,
* but that would add to the polling.
I hacked this together in about a minute, so it's not beautiful, but it
works.
$PLAN9/src/cmd/devdraw/x11-itrans.c:439:
prop = 1;
data = nil;
XChangeProperty(_x.display, _x.drawable, prop, _x.utf8string, 8, PropModeReplace, (uchar*)"", 0);
XConvertSelection(_x.display, clipboard, _x.utf8string, prop, _x.drawable, CurrentTime);
XFlush(_x.display);
lastlen = 0;
for(i=0; i<10 || (lastlen!=0 && i<30); i++){
usleep(100*1000);
XGetWindowProperty(_x.display, _x.drawable, prop, 0, 0, 0, AnyPropertyType,
&type, &fmt, &dummy, &len, &data);
if(lastlen == len && len > 0)
break;
lastlen = len;
}
if(lastlen == 0) {
XChangeProperty(_x.display, _x.drawable, prop, XA_STRING, 8, PropModeReplace, (uchar*)"", 0);
XConvertSelection(_x.display, clipboard, XA_STRING, prop, _x.drawable, CurrentTime);
XFlush(_x.display);
lastlen = 0;
for(i=0; i<10 || (lastlen!=0 && i<30); i++){
usleep(100*1000);
XGetWindowProperty(_x.display, _x.drawable, prop, 0, 0, 0, AnyPropertyType,
&type, &fmt, &dummy, &len, &data);
if(lastlen == len && len > 0)
break;
lastlen = len;
}
}
if(lastlen == 0)
goto out;
--
Kris Maglione
[-- Attachment #2: Type: application/pgp-signature, Size: 194 bytes --]
next prev parent reply other threads:[~2007-05-03 22:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-03 16:37 Skip Tavakkolian
2007-05-03 16:45 ` Rob Pike
2007-05-03 17:45 ` David Leimbach
2007-05-03 17:52 ` Rob Pike
2007-05-03 18:09 ` Paul Lalonde
2007-05-03 22:55 ` Kris Maglione [this message]
2007-05-04 2:26 ` Russ Cox
2007-05-03 17:03 ` Anthony Sorace
2007-05-03 17:22 ` Russ Cox
2007-05-03 18:02 ` Skip Tavakkolian
2007-05-03 21:20 Russ Cox
2007-05-04 0:00 ` Kris Maglione
2007-05-04 12:21 ` Derek Fawcus
2007-05-04 1:16 ` Scott Schwartz
2007-05-04 12:29 ` Derek Fawcus
2007-05-05 2:20 ` Kris Maglione
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=20070503225549.GA62050@kris.home \
--to=bsdaemon@comcast.net \
--cc=9fans@cse.psu.edu \
/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 NNTP newsgroup(s).