f



Perl/Tk: 'selection conversion left too many bytes unconverted' error on large text selection

Hi all,

I've written about this before, but it's come back and I still haven't 
found what the problem is.

Basically, in Perl/Tk if a textbox has a lot of text in it (no idea on 
the limit yet - all I know is that it has to be a _lot_ of text), and 
all the text is selected (and therefore copied to the clipboard) the 
entire perl process is halted, the gui disappears and the error:

selection conversion left too many bytes unconverted

appears on the command line.

This appears to be a tcl panic error (hence the cross-post to 
comp.lang.tcl as I'm not sure where the problem is) if google is 
anything to go by.

This has become a serious problem - users aren't too happy when a 
program crashes outright from something as simple as selecting text.

Does anyone have any idea how to avoid/fix this problem? I'm using perl 
v5.8.7 with Perl/Tk 804.027 and wish 8.4 is installed (if that has any 
bearing).

MB
0
not183 (4)
8/3/2005 1:52:16 AM
comp.lang.tcl 23428 articles. 2 followers. Post Follow

4 Replies
677 Views

Similar Articles

[PageSpeed] 52

Did you try the Perl/Tk group? This may be specific to Perl/Tk and not
Tcl/Tk.

Robert

0
tclguy (7)
8/3/2005 2:34:13 AM
You know, sometimes I don't like the new Google groups as I can't see
the headers without showing the "options".

Sorry, after posting it was obvious that you had posted to the Perl/Tk
group.

Robert

0
tclguy (7)
8/3/2005 2:36:08 AM
"Matthew Braid" <not@invalid.invalid> wrote
>
> Basically, in Perl/Tk if a textbox has a lot of text in it (no idea on
> the limit yet - all I know is that it has to be a _lot_ of text), and
> all the text is selected (and therefore copied to the clipboard) the
> entire perl process is halted, the gui disappears and the error:
>
> selection conversion left too many bytes unconverted


Never seen that one before.  But a little googling reveals this code in
TkSelPropProc in tkUnixSelect.c.  Here is a snippet of the code.  But I'm
not an X window or a UTF conversion guy, so I can't tell you what's really
going on here.


     /*
      * Encode the data using the proper format for each type.
      */

     if ((formatType == XA_STRING)
      || (dispPtr && formatType==dispPtr->utf8Atom)
      || (dispPtr && formatType==dispPtr->compoundTextAtom)) {
.... much code elided ...
  /*
   * Preserve any left-over bytes.
   */

  if (srcLen > TCL_UTF_MAX) {
      Tcl_Panic("selection conversion left too many bytes unconverted");
  }



Good luck,
Bob
-- 
Bob Techentin                   techentin.robert@NOSPAMmayo.edu
Mayo Foundation                                 (507) 538-5495
200 First St. SW                            FAX (507) 284-9171
Rochester MN, 55901  USA            http://www.mayo.edu/sppdg/




0
8/3/2005 12:47:08 PM
Bob Techentin wrote:
> Never seen that one before.  But a little googling reveals this code in
> TkSelPropProc in tkUnixSelect.c.  Here is a snippet of the code.  But I'm
> not an X window or a UTF conversion guy, so I can't tell you what's really
> going on here.
[...]
>   if (srcLen > TCL_UTF_MAX) {
>       Tcl_Panic("selection conversion left too many bytes unconverted");
>   }

The code's figured out that something odd is going on, as the external
to internal encoding conversion engine left more bytes over than ought
to be legal (i.e. more than the maximum number of bytes that a single
character may be represented as). That's the immediate cause, but I've
not the faintest idea what may be causing that.

Donal.
0
8/3/2005 3:37:33 PM
Reply: