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