THIS HAS OVER 17 VIEWS AND ZERO REPLIES. DO NOT READ IF YOU'RE NOT REPLYING!
--------------------
Hi. I've been writing a VERY crude addon to my forum which is basically a PHP/AJAX chat system. It's not deeply integrated with vB, and is using its own tables while being a templated PHP file. However, I've been trying to make it so that users can enter BBcode and have it parsed in the chat, ex:
PHP Code:
Jimmy bob, did you even [b]HEAR WHAT I SAID[/b]?? [i]Well?[/i]
Should appear with the proper HTML instead of BBcode.
I've been using
this tutorial for the BBCode parsing.
However, a *LOT* of funky stuff happens. Here's how the chat itself works, in a nutshell.
AJAX refreshes chat every XX seconds, PHP file returns latest XX messages pulled from DB, executing bbcode_parse on each of them before returning.
If user sends message, PHP file inserts message into DB.
The chat itself works fine, the problem is that the bbcode_parse will horribly mutilate the message. Example:
PHP Code:
<<<<<<<<<<<<<>>>>>>>>>>>>>>> <b>test!</b> [b]test![/b]
turns into
PHP Code:
<<<<<<<<<<<<<>?ƒ????>>ˆ??\?O؏ˆ?—]\?V??—
If the message had htmlentities() run on it before insertion into DB, the text is *slightly* less mutilated.
Is there some bbcode_parsed_decode or something I'm missing here? Any help would be greatly appreciated!