https://github.com/taskrabbit/demoji
Replace emojis as to not blow up utf8 MySQL.
https://github.com/taskrabbit/demoji
Last synced: 9 months ago
JSON representation
Replace emojis as to not blow up utf8 MySQL.
- Host: GitHub
- URL: https://github.com/taskrabbit/demoji
- Owner: taskrabbit
- License: mit
- Created: 2014-02-14T19:48:41.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2021-01-06T18:48:37.000Z (about 5 years ago)
- Last Synced: 2025-05-30T00:48:05.951Z (10 months ago)
- Language: Ruby
- Size: 19.5 KB
- Stars: 41
- Watchers: 14
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

# Demoji
MySQL configured with utf-8 encoding blows up when trying to save text rows containing emojis, etc., to address this, Demoji rescues from that specific exception and replaces the culprit chars with empty spaces.
This is a workaround until Rails adds support for UTF8MB4 in migrations, schema, etc.
## Installation
Add this line to your application's Gemfile:
gem 'demoji'
And then execute:
$ bundle
Or install it yourself as:
$ gem install demoji
## Usage
Write an initializer in: `config/initializers/demoji.rb`:
```ruby
ActiveRecord::Base.send :include, Demoji
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request