Some people here discovered some time ago that typing the message "=A=" gives "__E&E__". Well, isn't that just the cutest little thing?
Today, I found out why.
I noticed when inspecting network requests to and from the chat, that "=" gets transformed into "__E__"
Hey, that's curious... looks a bit like an HTML entity would, doesn't it?
Sure enough, it seems a small handful of HTML entities are translated:
input output
__A__ &
__PS__ +
__C__ ,
__E__ =
So the original string, "=A=", expands to "__E__A__E__", but for some reason, "__A__" is replaced first, thus giving the strange "__E&E__". However, "__A__E__A__" is correctly contracted to "&E&".This gives me the terrible feeling that someone somewhere is chaining string replace on the message like so:
message = message
.replace("__PS__","+")
.replace("__A__","&")
.replace("__E__","=")
.replace("__C__",",");
... which doesn't make sense, since both PHP and javascript have a callback for regular expression replace:$replacements = [
"__A__" => "&", # or html equivalent
"__PS__" => "+",
"__C__" => ",",
"__E__" => "="
];
preg_replace($message,"/__[A-Z]{1,2}__/g",function ($match) use(&$replacements) {
return @$replacements[$match] ?: $match;
});
Sooo... wtf, IPS.