Bug in Xboard paste text

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Bug in Xboard paste text

Postby PulsarMike » 10 Jun 2019, 08:53

I often when on FICS and chatting want to copy some text in. Almost always from a web page as a supplement to the chat. Xboard seems to not handle it when it hits any special text characters and most things cant be cleanly pasted in. it gets 5 words then the quote is a smart quote or something and it only pastes in 5 of 30 words. I can then go and paste some more till i'm done but it gets tedious as you want to just paste in. I know In Java with clients Java naturally just handles all that and if a character cant translate it comes up with something and doesn't terminate pasting the rest of the tell.

I didn't save example tells as they were all web pages of the moments interest but a review for my Pulsar iOS app has to be pasted in like 6 times bit by bit before it completes so will give that text.

"The biggest seiret of the AppStore—so FANTASTIC to have a place where u can Play variations of Chess vs a computer...why on Earth hasnt this app Been discovered by many more ppl——Its the only app that serves u a computer opponent to Play these variations of chess outthere...everyone plays chess....maybe the company shudve done a better job getting this app seen on the Appstore?? BRILLIANT——LOVE IT.....12 POINTS FROM NORWAY"

Though i'm not sure if the paste into the forum cleaned that up now to be pasteable. But it's not hard to just post web text and have xboard fail. It's the norm.
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Bug in Xboard paste text

Postby H.G.Muller » 11 Jun 2019, 10:27

I pasted the text you give into XBoard when logged in to the winboard.nl ICS, and get back the error message that the text contains unprintable characters. Making a debug log shows that the problem is not really in XBoard, but in the ICS:

Code: Select all
>ICS: tell admin The biggest seiret of the AppStore\342\200\224so FANTASTIC to have a place where u can Play variations of Chess vs a computer...why on Earth hasnt this app Been discovered by many more ppl\342\200\224\342\200\224Its the only app that serves u a computer opponent to Play these variations of chess outthere...everyone plays chess....maybe the company shudve done a better job getting this app seen on the Appstore?? BRILLIANT\342\200\224\342\200\224LOVE IT.....12 POINTS FROM NORWAY\015\012
<ICS: Your message contains some unprintable character(s).\012\015fics%

The dashes are not really dashes, but apparently some special unicode long-dash character. The ICS does not like that, and refuses the message. But XBoard just pasted and sent it as requested.

I don't understand how it can work in other clients, unless there is some way to put the ICS into unicode mode that they automatically exercise, and that XBoard doesn't know about. (winboard.nl in any case does not support such a mode.) Of course I can make XBoard filter out any multi-byte unicode in the commands it sends to ICS, but this will mutilate the message. So it doesn't really seem a solution. It could also be that other clients have their own system in escaping unicodes as sequences of normal ascii, perhaps even through some de-facto standard shared by different clients. In theory XBoard could then use such escaping too. But I would have to know what standard that is...
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Bug in Xboard paste text

Postby PulsarMike » 17 Jun 2019, 09:50

well i think fics and icc and anyone running off their old code have always used one byte text characters. they are servers that got written in C starting out with chars.
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Bug in Xboard paste text

Postby H.G.Muller » 17 Jun 2019, 10:25

Sure, but other unicodes could be 'escaped' by sequences of such characters. Like the &#nnn; notation in HTML, with nnn the unicode > 127. Perhaps some of the clients do apply such conversions, both ways, and can get around the limitations of the ICS.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Bug in Xboard paste text

Postby PulsarMike » 18 Jun 2020, 11:24

I"ve now got my own Mac app http://www.adammr.com/diamondonmac.html that connects to FICS, xBoard on Mac is still my backup and also used with my engine. But this code for my mac client lets me paste anything into FICS from any web page never an issue except I sometimes get your message is to long from Diamond.

data = [data stringByReplacingOccurrencesOfString: @"“" withString:@"\""];
data = [data stringByReplacingOccurrencesOfString: @"„" withString:@"\""];
data = [data stringByReplacingOccurrencesOfString: @"’" withString:@"'"];
data = [data stringByReplacingOccurrencesOfString: @"”" withString:@"\""];

// tel guestcctp i’m mike “you are?”
NSString *tempData = @"";
for (int aa = 0; aa < [data length]; aa++) {
if([data characterAtIndex:aa] == '\n' || ( [data characterAtIndex:aa] > 31 && [data characterAtIndex:aa] < 127))
tempData = [tempData stringByAppendingFormat:@"%c", [data characterAtIndex:aa]];
}

data = tempData;

I put this at the network layer at spot i send over socket to fics the data.
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Bug in Xboard paste text

Postby H.G.Muller » 18 Jun 2020, 19:18

What programming language is that? One that I cannot read, for sure...
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Bug in Xboard paste text

Postby PulsarMike » 18 Jun 2020, 20:12

The first part just means whatever string you're sending fics replace the first stuff between quotes with second. Most langauges have some replace in string string1 wiht string2 or pattern1 with pattern2
data = [data stringByReplacingOccurrencesOfString: @"“" withString:@"\""];
data = [data stringByReplacingOccurrencesOfString: @"„" withString:@"\""];
data = [data stringByReplacingOccurrencesOfString: @"’" withString:@"'"];
data = [data stringByReplacingOccurrencesOfString: @"”" withString:@"\""];

the second part stuff like [data characterAtIndex:aa] == '\n' can be read if data was a char array as data[aa] == '\n'. its saying whatever it int char sendData[] loop through it and only copy to newSendData[] characters that are the '\n' or if the int value of sendData[aa] is > 31 and < 127. So if sendData[] length was 10 but i had one character that was not between 32 and 126 or a '\n' then dont copy it to newData[] and its length would then be 9.

ITs two routines first the replace string with string in string then the copy from start to finish all characters in range.



NSString *tempData = @"";
for (int aa = 0; aa < [data length]; aa++) {
if([data characterAtIndex:aa] == '\n' || ( [data characterAtIndex:aa] > 31 && [data characterAtIndex:aa] < 127))
tempData = [tempData stringByAppendingFormat:@"%c", [data characterAtIndex:aa]];
}

data = tempData;
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 2 guests