What's the best way to prevent special commands (SMS) during POST statuses/update?


#1

I just got POST statuses/update working but I’m now trying to figure out the best way of stripping out special commands. I tried replacing the first character with a “no-break space” (%A0). However twitter translated this to an unknown character with (e.g. M<?>Username tweet).

The only other option I can think of is creating a regex which strips out all potentially hazardous SMS code. This isn’t ideal since I would prefer to keep the raw tweet. Such as tweeting: “D Day was an alright movie.” would result in “Day was an alright movie.”

I also tried entering a space before the post but it just got ignored. Is there some sort of escape character?


#2

Found the solution to this one. :slight_smile:

Ended up being two issues. First off I wasn’t percent encoding correctly causing the <?> characters. After that I found out that U+00A0 wasn’t doing the trick because the API treats all white space characters the same.

However, if you insert a zero-width space after the SMS command it works perfectly. Such as, “M[U+200B] Username”


#3

[Duplicate Removed]