wpstubs icon indicating copy to clipboard operation
wpstubs copied to clipboard

Strip special characters from hashtags

Open dartar opened this issue 10 years ago • 3 comments

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

dartar avatar Aug 04 '14 07:08 dartar

It might actually be worthwhile using Twitter's official JavaScript text processing library (twitter/twitter-text-js) here.

phuedx avatar Aug 07 '14 10:08 phuedx

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.

theopolisme avatar Aug 08 '14 22:08 theopolisme

We also have issues with special characters in links, see https://twitter.com/wpstubs/status/497984790360899585

dartar avatar Aug 09 '14 06:08 dartar