Our iphone app has a chatroom where users can post comments. Recently, the chatroom has been crashing the app because users are adding emojis to their comments. I went to my server PHP script to not allow characters that aren't in the A-z0-9 range (I also allow around 30 punctuations characters) hoping that this would prevent the app/feed from crashing. However, emojis are still crashing the chatroom.
This is my regular expression filter in my server script that disallows comments with special characters:
$special = "/\W/";
$special2 = "/[\~\!\@\#\$\%\^\&\*\(\)\_\+\`\-\=\{\}\|\:\\\"\<\>\?\,\.\/\;\'\[\]]/";
if ((preg_match($special,$comment)) && (!preg_match($special2,$comment)))
The PHP statement above says is that if the script finds a character that is not [A-z][0-9] and not one of the punctuation marks listed, then to reject the comment.
The comment that broke the app recently is below:
<comment>Exciting timesits all about the î§ go Team!!</comment>
Any suggestions on what to do to prevent the app from crashing?