How can I delete special characters?

First of all, I think it might be easier to define what constitutes “correct input” and remove everything else. For example:

input = input.gsub(/[^0-9A-Za-z]/, '')

If that’s not what you want (you want to support non-latin alphabets, etc.), then I think you should make a list of the glyphs you want to remove (like ™ or ☻), and remove them one-by-one, since it’s hard to distinguish between a Chinese, Arabic, etc. character and a pictograph programmatically.

Finally, you might want to normalize your input by converting to or from HTML escape sequences.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)