Unaccent

Ruby gem to replace a string's accent characters with ASCII characters. Based on SixArm Ruby Unaccent.

Gem Version Build Maintainability

Installation

Add this line to your application's Gemfile:

gem 'unaccent'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install unaccent

Usage

require 'unaccent'

Unaccent.unaccent('déjà vu') # deja vu
Unaccent.unaccent('νέα')     # νεα

require 'unaccent/string'

'déjà vu'.unaccent # deja vu
'νέα'.unaccent     # νεα

Benchmark

IPS Comparison:
                gsub:    33804.1 i/s
           each_char:    16639.9 i/s - 2.03x  (

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hardpixel/unaccent.

License

The gem is available as open source under the terms of the MIT License.