No commit activity in last 3 years
No release in over 3 years
Make utf8_enforcer to be applied only for non-standards-complying browsers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0
~> 1.12
~> 2.2
~> 0
~> 1.3

Runtime

~> 0.1, >= 0.1.0
>= 3.2.0
 Project Readme

Utf8EnforcerWorkaround

Gem Version Build Status Dependency Status Code Climate

For Rails version < 6 Rails inserts a hidden form input element to make IE 8 and older use UTF8. This gem makes the utf8 enforcer element to be applied only for non-standards-complying browsers.

For Rails 6 the default behaviour does not bloat forms with IE8- specific issues, so this gem is no longer relevant for Rails 6 and forward.

Requirements

utf8_enforcer_workaround depends on Rails and browser

Supported Rails versions

  • Rails 3.x
  • Rails 4.x
  • Rails 5.x

From Rails 6.0.0 the default behaviour is not to have a hidden tag to enforce utf8 for IE 8 or older, see (https://github.com/rails/rails/commit/96eeea538c9c5b7b60d6f8baed2e86a9e2a920c9). So this gem is not relevant for Rails 6 and upwards.

Installation

Add this line to your application's Gemfile:

gem 'utf8_enforcer_workaround'

And then execute:

$ bundle

Or install it yourself as:

$ gem install utf8_enforcer_workaround

Usage

Add this line of code in your ApplicationController:

utf8_enforcer_workaround

Alternatively you can write your own logic in your ApplicationController to decide whether or not to include the utf8 enforcer tag. Here is an example showing the default logic:

before_action do
  @utf8_enforcer_tag_enabled = browser.ie?
end

Development

gem install bundler
bundle install
bundle exec appraisal generate
bundle exec appraisal install
bundle exec appraisal rake

Releasing

Update lib/utf8_enforcer_workaround/version.rb and commit. Then

git tag v<version>
git tag push --tags
gem build utf8_enforcer_workaround.gemspec
gem push utf8_enforcer_workaround-<version>.gem

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2012-2019 Jarl Friis. See LICENSE.txt for further details.