Xo Emoji is a Ruby Gem specifically written for strip invalid unicodes by cleaning up any string.
Just add the following to your Gemfile.
gem 'xo_emoji', '~> 0.0.2'
And follow that up with a bundle install
.
Let's supose that we have a string that already has emojis and you want to remove that:
str = "Yesterday I got a beer, again! 😬 "
puts str.strip_emojis
> Yesterday I got a beer, again!
xo_emoji is released under the MIT License.