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 23429 articles. 2 followers. Post Follow

4 Replies
531 Views

Similar Articles

[PageSpeed] 47

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:

Similar Artilces:

Solution [ Perl/Tk: 'selection conversion left too many bytes unconverted' error on large text selection ]
After I got bitten enough by this error and found no solution on the web I had to debug it myself. For me it looks like the following: - text get selected from Tk::Text - TkSelPropProc in ./pTk/mTk/unix/tkUnixSelect.c gets called to handle the selection which determines that the display supports utf-8 and thus gets Encoding::utf8 as the responsable encoder (see Encode::Encoding for the interface) - then it calls Tcl_UtfToExternal to convert the selection from internal format to utf8, this function is defined in encGlue.c and just calls CallEncode in the same fil...

Weird and downright annoying error: 'selection conversion left too many bytes unconverted'
Hi all, We recently upgraded our systems including a perl upgrade to version 5.8.7. I've noticed some damn weird things, but so far only one has affected Tk. If I have a text box with a certain number of characters in it (no idea how many - the example this is happening with is a few hundred lines long) and I then select all the text, perl bails (instant tear-down of the gui) but all that is printed to stderr is: selection conversion left too many bytes unconverted A google search finds this is a Tk panic error, but that's about all I can find. No help in some w...

conditional selection of 'AND' or 'Select' in Oracle
I am working on Oracle reports . One of the parameters that a User inputs is 'report_type'. Now, is there a way to do the following within a SQL query with no use of procedures or functions. select blaa from foo where something = something // if report_type='some_data' then and somethingelse = something else //else do nothing Also, IS there a way of doing something like the following // if report_type='some_data' then select blaa from foo where something = something // if report_type='some_data' then and somethin...

Tk::ROText: selection conversion left too many bytes unconverted
Hi folks, I_m using perl 5.8.7 + Tk 800.027 and when i select some text in the Tk::ROText widget and try it to copy somewhere else, my perl program will crash with the message: "selection conversion left too many bytes unconverted". The problem occures, if I have ISO8859-1 characters (german umlauts) written to the widget, anyway, the characters are displayed correctly. I did it on RHEL4 displaying on Windows with X-Manager (from netsarang). I also tried it on SuSE Linux 6.2 on buildin XServer (Perl/tk extra compiled for that). Results were just the same :-( I could...

'Select top 10 * ...' returns data but 'Select * ..' does not
Hi I have a query that is performing very strangely. I f I put a top statement in it returns rows, so Select top 10 * from ....... returns 10 rows but without it then no data is returned Select * from .......... returns 0 rows. The problem lay in a join to another database on a datatype of sqlvariant. BOL shows how the sql_variant comparison rules work. I needed to bypass these for data in rows after my top 10 list provided. I had to use openquery and cast the datatype first to get a join. ...

How do I 'SELECT All' text in a text box
I want to select all text in a multi line text box from a command butten. Thank for help Dave Try this... Private Sub Command1_Click() With Text1 .SelStart = 0 .SelLength = Len(.Text) .SetFocus End With End Sub Rick - MVP "Dave" <last2try@earthlink.net> wrote in message news:fo0b90h0j9imbvntdea3uu2mefth5teufr@4ax.com... > I want to select all text in a multi line text box from a command > butten. > > Thank for help > Dave ...

??? document.getElementById('ID').style.-moz-user-select = 'text' ???
Hallo, of course, this doesn't work: document.getElementById('ID').style.-moz-user-select = 'text'; - but i hope it shows my problem... Is it possible to set this css option by javascript and how? Is there any workaround for that? I'd need this to temporarily avoid text selection. Many thanks and best regards, Michael Michi wrote: > Hallo, > > of course, this doesn't work: > document.getElementById('ID').style.-moz-user-select = 'text'; > - but i hope it shows my problem... > > Is it possible to set this css option by jav...

Parse error: parse error, expecting `','' or `';''
I'm getting the following error Parse error: parse error, expecting `','' or `';'' in /home/notarywe/public_html/php/update2.php on line 108 Here is line 108 <input type="text" name="ud_first" value="<? echo "$first" size="20"?>"></td> Any help would be appreciated. On 3-Aug-2003, "entoone" <entoone@pacbell.net> wrote: > I'm getting the following error Parse error: parse error, expecting `','' > or > `';'' in /home/notarywe/public_h...

error: expected '=', ',', ';', 'asm' or '__attrib
Hi I'm trying to compile an ADC Driver & come acrosss the following error. I've no experience writing drivers before, and hence have no clue how to fix it. Hope someone out there has encountered the problem & suggesst a fix for the same. The Error is I get is : qadc.c: At top level: qadc.c:97: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'qadc_read' make: *** [qadc.o] Error 1 [root@localhost qadc]# ########################################################################### ADC Driver Code ##...

assigning 'selected' to option in form select
Hi <form nam="country" ... <select name="industy" ... <option ... selected> ... </option> <option ... Now, in Javascript, I want to change defaulted "selected" to fourth option. document.country.industry.options[3].selected=true; but I get an error. Is the syntax wrong? Regards John -------------------------------------------------------------------------------- I am using the free version of SPAMfighter for private users. It has removed 91027 spam emails to date. Paying users do not have this message in their emails. Try SPAMfi...

'dataread' and 'textscan' Large Text Files
Hi folks, I have a working Simulink model in SimEvents which reads data from a text file. Each row includes entitiy attributes which I assign to an entity generated by an Entity Generator block. The porblem I'm experiencing now is the long time it takes to finish reading/extracting all of the rows each clock time. You see, when I did my coding at the beginning, I was working on small files, say 150-ish rows each. Now, I'm dealing with > 40k rows. Here is a brief on my coding/functions I've implemented: First, I have an Entity Generator. The number of entites leaving the block is labelled 'd'. I'm using 'd' as an input to an Embedded Matlab Function that reads the number of rows of the text file. Basically, the 'd' works as the index in reading the "current" row. The reason for this function is it computes the 'inter-generation time' for the Entity Generator. It might sound a bit weired, but basically the 'intergeneration time' of entities are computed via an Embedded Matlab Function, and it uses the 'd' as the index. Now, in the Embedded Matlab Function, I have the following code: ______________________________________________ function intergen_time = fcn(d) eml.extrinsic('dataread') rows = 0; rows = length(dataread('file', 'MyTextFile.txt', '%s', 'delimiter', '\n')); if d <= rows intergen_time = d * 1e-10; else intergen_time...

error fopen('text.txt','w')
i am a beginner in Matlab guys, so i can't figure out what's wrong with my code. i need to open a text file and write data to it, but i got an error. here my simple code (sorry, my English is bad) >> pwd ans = C:\Program Files\MATLAB\R2012a >> fid=fopen('text.txt','w') fid = -1 The text.txt doesn't exist. On 11/1/2015 11:48 PM, Tunggul Sagala wrote: > i am a beginner in Matlab guys, so i can't figure out what's wrong with my code. >i need to open a text file and write data to it, but i got an error. here my si...

'is not' or '!='
A newbie question to you; what is the difference between statements like: if x is not None: and if x != None: Without any context, which one should be preferred? IMHO, the latter is more readable. On 2014-08-18 21:35, ElChino wrote: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: > > Without any context, which one should be preferred? > IMHO, the latter is more readable. > "x == y" tells you whether x and y refer to objects that are equal. "x is y" tells you whether x and y actually refer to the same object. In the case of singletons like None (there's only one None object), it's better to use "is". "ElChino" <elchino@cnn.cn>: > A newbie question to you; what is the difference between statements > like: > if x is not None: > and > if x != None: Do the following: take two $10 bills. Hold one bill in the left hand, hold the other bill in the right hand. Now, the bill in the left hand "is not" the bill in the right hand. However, the bill in the left hand "==" the bill in the right hand. > Without any context, which one should be preferred? > IMHO, the latter is more readable. In almost all cases, both tests would result in the same behavior. However, the "is not" test is conceptually the correct one since you want...

'^=' and '~='?
Hello, What is the difference between '^=' and '~='? Thanks, Duckhye ...

builder.node('select'..) selected not working solution
FYI, with something like this: hotelement = "hotelement"+hotcount; hotspot = Builder.node('div', { id:'hotspot'+hotcount, className:'hotspot', style:''+divstyle }, [ Builder.node('select', {id:hotelement, onChange:hotspotlink}, [ Builder.node('option',{value:'textfield', selected:''},"textfield"), Builder.node('option',{value:'textarea'},"textarea"), Builder.node('option',{value:'dropdown'},"dropdown"), Builder.node('...

Select 'Current LSN' and 'Transaction ID' from ::fn_dblog
Gurus, How do I choose multi-name 'columns' like "Current LSN" or "Transaction ID" from ::fn_dblog? I CAN select single 'column' names like 'Operation' and 'Context'. I do NOT want all 'columns' returned: - I don't want Select (*) from ::fn_dblog Doug Doug, Usually you use brackets [] around column names that are separated by spaces. That is why many designers use a replacement character for the space, like the underscore. Steve Thanks Steve :-) ...

How is there an 'error' with 'no message'
I have a form with many fields, each of which has their separate record sources in a split db. Today, several users throughout the afternoon encountered the following message when accessing various dropdowns on the form: "Error (-1517). There is no message for this error." Three questions: 1. Has anyone encountered this error before? 2. If so, how was it overcome? 3. How can MS produce an error message that states : "There is no message for this error"? It would seem to me that if MS has assigned a number to an error, they must know that it can happen. If they k...

Why does 'SELECT * FROM countries' truncate characters and SELECT country FROM countries does not ?
Hi, Why does 'SELECT * FROM countries' truncate characters and SELECT country FROM countries does not ? mysql> SELECT * FROM countries; +-------------+-----------+ | country | capital | +-------------+-----------+ |ghanistan | Kabul |lbania | Tirane |Algeria | Algiers mysql> SELECT country FROM countries; +-------------+ | country | +-------------+ | Afghanistan | | Albania | | Algeria | +-------------+ 3 rows in set (0.00 sec) c:\countries.csv Afghanistan, Kabul Albania, Tirane Algeria, Algiers mysql> LOAD DATA LOCAL INFILE '...

"Select" & "Order By" OK- ''WHERE'' Does'nt Work !
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've reduced my form request to a simple text string entry, instead of my desired optional parameters. As i have been stuck with a single unfathomable glitch for over a year. Basically, if i enter queries such as ; "select * from table" "select * from table order by artist", it works perfectly. However if i introduce the 'where' option, as in "select * from table where ...

Korn shell's 'select'
(Sorry for using a Windows SMTP program...) I just discovered a neat feature of ksh: 'select'. I need to create a listing of items from a file, and select does the thing... Well almost... Using something like this: user@server> cat file.test test test1 user@server> select ENTRY in `cat file.test` > do > echo $ENTRY > break > done 1) test 2) test1 #? 1 test From the above, I'd actually would like option 1) to show up as "test test1", and not split up. Any ideas? I've tried editing file.test to replace spaces with ";", then trying to co...

error C2143: syntax error : missing ';' before '*'
Hi all, how to remove the following complle error. When I compiling the code I get the following errors: Compiling... CDrtEachDefFeat.cpp d:\ include\common\cdrtintegfeat.h(39) : error C2143: syntax error : missing ';' before '*' d:\ include\common\cdrtintegfeat.h(39) : error C2501: 'CDrtEachDefFeat' : missing storage-class or type specifiers d:\ include\common\cdrtintegfeat.h(39) : error C2501: 'm_pdrtEachDefFeat' : missing storage-class or type specifiers In code the files are included in the order, CDrtEachDefFeat has # include "CDrtTeachData"...

Install cygwin by selecting 'select all' options - CYGWIN
Hi, Why is the cygwin installion like this --> skip by default and we have to go and select every required tool. Why dont they keep the 'select all' option Or something similar to normal Redhat Installation that quries (Desktop/Server/Minimal/Full/etc...) Going and selecting the things we need and sometimes we miss some utilities and this causes problems....(we have to update it once again friends).i think many would have faced it. The Cygwin Installation method is Gooood, But needs some more features to get going on easily for guys who have little time to select e...

Quotes from the 'tolerant', 'liberal', 'progressive' Left
"I hope his wife feeds him lots of eggs and butter and he dies early like many black men do, of heart disease. ... He is an absolutely reprehensible person." --USA Today Columnist Julianne Malveaux on Justice Clarence Thomas "If there is...justice, he'll get AIDS, or one of his grandchildren will get it." --National Public Radio's (NPR) Nina Totenberg on Sen. Jesse Helms "[I]t may take the destruction of Western Civilization to allow the rest of the world to really emerge as a free and brotherly society." --Newly elected president of that hot-bed of co...

How to change 'On Error Goto ArreurA' with 'On Error Goto ArreurB' without error if an error occured?
Exemple: On Error Goto ErreurA Picture = LoadPicture(VarName1) On Error Goto ErreurB Picture = LoadPicture(VarName2) exit sub ErreurA: msgbox "ErreurA= VarName1" exit sub ErreurB: msgbox "ErreurB= VarName2" Exit sub If an error occudes with Picture = LoadPicture(VarName2) it cause an error and the program stop there without error message. What code line must I add? Raymond H. "Raymond H." <divers_rh@hotmail.com> wrote in message news:TuHRc.6180$a65.235836@news20.bellglobal.com... > Exemple: > > On Error Goto ErreurA > Picture = LoadPicture(VarName1) > On Error Goto ErreurB > Picture = LoadPicture(VarName2) > exit sub > ErreurA: > msgbox "ErreurA= VarName1" > exit sub > ErreurB: > msgbox "ErreurB= VarName2" > Exit sub > > If an error occudes with > Picture = LoadPicture(VarName2) > it cause an error and the program stop there without error message. What > code line must I add? In the IDE, go to Tools->Options->General Tab. Select 'Break on Unhandled Errors'. Hello, this error occure even with the exe. I think it miss a code line in my projet but I don't know wich one. r.h. "Peter Young" <youngpa@comcast.no.net.spam.please> a �crit dans le message de news:eBMRc.229775$%_6.160126@attbi_s01... > > "Raymond H." <divers_rh...

Web resources about - Perl/Tk: 'selection conversion left too many bytes unconverted' error on large text selection - comp.lang.tcl

Resources last updated: 3/13/2016 5:24:13 PM