Thanks to Tig for some ingame help. Unfortunately we couldn't come up with an efficient way that works, but after he left, I still had an idea and turned it into something that seems to be pretty efficient. Not as much as other things, but it's still working and doesn't eat alot of CPU.
If anybody else is looking for a solution, I'm going to share this with you. It eliminates the backslashes that are created by escape(), and
only those.
PHP Code:
while (newChat.pos("\\\"") > -1 || newChat.pos("\\'") > -1 || newChat.pos("\\\\") > -1) { //"
if (newChat.pos("\\\"") > -1) //"
newChat = newChat.substring(0, newChat.pos("\\\"")) @ newChat.substring(newChat.pos("\\\"") + 1);
else if (newChat.pos("\\'") > -1)
newChat = newChat.substring(0, newChat.pos("\\'")) @ newChat.substring(newChat.pos("\\'") + 1);
else
newChat = newChat.substring(0, newChat.pos("\\\\")) @ newChat.substring(newChat.pos("\\\\") + 1);
}
There are some comments here and there with just a quotation mark. I added those to fix the syntax highlighting that has some problems with the escaped quotation mark.