Re: Bug/feature requestB

Meredydd <[email protected]> Wed, 17 Mar 2004 22:39:33 +0000
Newsgroups gmane.network.everybuddy.devel
Message-ID <[email protected]>
On Wednesday 17 March 2004 22:23, A. Craig West wrote:
> Now that ebnc is using the nifty stripped version of the messages, I
> have noticed a bug with how we do it. Possibly two bugs, but one of
> them looks like a feature...
Correctly identified :^)

> In Yahoo, if somebody is using that funky multicolour text, they send
> messages that look like:
> <FADE #ff0000,#00ff00,#0000ff>Foo bar baz</FADE>
> For some reason this is coming through without being stripped...
> Actually, it is even more interesting. When strip is off, it gets
> sent as: &lt;FADE #ff0000,#00ff00,#0000ff>Foo bar baz&lt;/FADE>
Right. That's a feature. The core's internal HTML parser understands 
<html>, <body>, <p>, <font>, <i>, <b>, <u>, and so on, but when it hits 
a left-angle-bracket which *isn't* part of an understood HTML tag, it 
tags it as an &lt; entity. That way, when someone sends a message with 
"<g>" in it, once it hits a UI, it looks like this: "&lt;g>".

That way, a "forgiving" HTML parser (such as a web browser, or Qt's HTML 
widget) will display it correctly, rather than silently dropping the 
tag - or worse, executing Javascript associated with it or some such 
nasty.

> and when strip is on it gets sent as:
> <FADE #ff0000,#00ff00,#0000ff>Foo bar baz</FADE>
If you've asked for stripped text, you're saying you're a text-only UI. 
Therefore, it would be positively antisocial to give you "&lt;g>" when 
you would display "<g>" perfectly fine, and with no ill effects. So, as 
part of the plaintext-rerender routine, as well as stripping out 
irrelevant tags (formatting, colour, etc), it puts back the ASCII 
equivalents of any HTML entities. In case you're interested, it also 
includes newlines instead of <br> tags.

> The one that might not be a bug is when the other user just specifies
> a single colour. It appears that Yahoo is sending an ansi code
> directly or something. eb-console shows the text changing colour
> directly (because the term is parsing the code) while ebnc is showing
> the actual ansi code, for example: ^[[35mFoo bar baz
Right. This should be handled within the Yahoo code. The standard 
exchange format within the core is HTML text. Likewise <FADE> - it 
really ought to be either dealt with or stripped before it hits the 
generic message-handling routines.

> It could be the core that is doing that, I'm not sure how much
> parsing is happening before it gets to eb-console...
None :^)

Meredydd