ANSI colors not being displayed

User avatar
SlySven
Posts: 892
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: ANSI colors not being displayed

Post by SlySven » Thu Jul 26, 2018 12:24 pm

Oh, those sequences do look wrong:
Screenshot_20180726_130747.png
The string shown as:
"Lerde[nice] >> \033[38;40;0m\000\000\007�\000\000\002�\033[42;37;1mThe village church\033[38;40;\r"
is wrong IMHO, according to Wikipedia and the original origins of the SGR codes https://www.itu.int/rec/dologin_pub.asp ... type=items indicate that SGR 38 i.e. '\033' followed by '[' followed by "38;" should be followed by a number in the range of '0' to '5' and Mudlet only handles
'5' for the ANSI 256 colour mode and partially handles '2' for 16M colour (24-bit) direct colour codes - there is no way that "40" is a valid value...!

User avatar
SlySven
Posts: 892
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: ANSI colors not being displayed

Post by SlySven » Thu Jul 26, 2018 12:49 pm

Yeah the second replay is riddled with "\033[38;40;0m" entries that seem to be use to "reset" the color except that if it wanted to make things "White on a Black background with no other rendering effects" then they should have used "\033[37;40;0m" or if they just wanted to reset things back to the user's default fore and background - whatever the USER had chosen - they should be sending just "\033[0m" and technically they do not need even that "0" - though it is probably wise to include it.

On the whole I think this is a MUD server configuration issue...

chrio
Posts: 66
Joined: Mon Aug 22, 2016 11:34 am

Re: ANSI colors not being displayed

Post by chrio » Thu Jul 26, 2018 2:13 pm

SlySven wrote:
Thu Jul 26, 2018 11:59 am
I am just taking a look at this and will see what I can find - I expect some recent improvement I made to the ANSI SGR code handling has made things much better except for a corner case that is now being hit...
I tested with mudlet 3.0.1 downloaded from the archives and it had the same problem. Perhaps some changes have been made serverside that made it incompatible with mudlet.

On the other hand, ANSI colors works on that mud with the other mudclients I have tried (ZMud/MushClient/Wintin++) and also in Putty, but it may be that they are more forgiving.

User avatar
Vadi
Posts: 4608
Joined: Sat Mar 14, 2009 3:13 pm

Re: ANSI colors not being displayed

Post by Vadi » Fri Jul 27, 2018 4:42 pm

Would you mind reporting the issue to them about the invalid ANSI?

chrio
Posts: 66
Joined: Mon Aug 22, 2016 11:34 am

Re: ANSI colors not being displayed

Post by chrio » Mon Jul 30, 2018 2:46 pm

Sorry for the late response, I've been on vacation over the weekend.
Vadi wrote:
Fri Jul 27, 2018 4:42 pm
Would you mind reporting the issue to them about the invalid ANSI?
Sure, I'll try to get in touch with them.

chrio
Posts: 66
Joined: Mon Aug 22, 2016 11:34 am

Re: ANSI colors not being displayed

Post by chrio » Mon Jul 30, 2018 4:08 pm

Thanks for the links it was good reading. I took look at it and would like to discuss it some more. I found more on wikipedia https://en.wikipedia.org/wiki/ANSI_esca ... parameters (mostly the same info, but more selective).
SlySven wrote:
Thu Jul 26, 2018 12:24 pm
Oh, those sequences do look wrong:
Screenshot_20180726_130747.png
The string shown as:
"Lerde[nice] >> \033[38;40;0m\000\000\007�\000\000\002�\033[42;37;1mThe village church\033[38;40;\r"
is wrong IMHO, according to Wikipedia and the original origins of the SGR codes https://www.itu.int/rec/dologin_pub.asp ... type=items indicate that SGR 38 i.e. '\033' followed by '[' followed by "38;" should be followed by a number in the range of '0' to '5' and Mudlet only handles
'5' for the ANSI 256 colour mode and partially handles '2' for 16M colour (24-bit) direct colour codes - there is no way that "40" is a valid value...!
As for \033[38;40;0m then yeah, this looks messed up, but shouldn't the following SGR code override it, if it's later in the string? Currently it seems to give up for the remainder of the buffer which seems excessive.

If we take a look at the sequence \033[42;37;1mThe village church this displays bold(1) white text(37) on green background(42) in putty, and this sequence should be correct.

User avatar
SlySven
Posts: 892
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: ANSI colors not being displayed

Post by SlySven » Mon Jul 30, 2018 5:22 pm

Trouble is though that the bytes immediately after the broken SGR code is a pair of ASCII NUL (\000 = ASCII code 0) bytes - and those normally indicate the end of the string. That might be why the remainder is disappearing - though I'd have to check to see if that is what would happen...

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests