wpstubs
wpstubs copied to clipboard
Strip special characters from hashtags
Special characters break hashtags: https://twitter.com/wpstubs/status/496166123277012992
We might replace characters like "&" that we can't strip without altering the meaning of the hashtag, see https://twitter.com/wpstubs/status/496151412510695424
It might actually be worthwhile using Twitter's official JavaScript text processing library (twitter/twitter-text-js) here.
I'm not sure that library is really all that useful here (it is intended for parsing tweets, not creating them, although certainly some of their regexps might be helpful...).
Until we come up with a better/fancier solution, for now I think stripping all non-alphanumeric characters (plus underscores) is a safe and easy way to handle this.
Open to suggestions though.
We also have issues with special characters in links, see https://twitter.com/wpstubs/status/497984790360899585