Skip to content

Instantly share code, notes, and snippets.

View 20TRIES's full-sized avatar

Marcus 20TRIES

  • Shopify
  • UK
  • 14:03 (UTC)
View GitHub Profile
@joakimk
joakimk / solution.md
Last active October 13, 2023 17:00
Seeing "Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT" after upgrading from Rails 3 to Rails 4?

For us this turned out to be that we had cached html generated by the rails 3 app that had the ASCII-8BIT encoding, clearing all html caches fixed this.

To arrive at this, we first added this debug code:

# if you reuse this: ensure it matches the method in your version of rails
# as the method is overwritten by this monkeypatch

# config/initializers/debug_encoding_errors.rb
ActiveSupport::SafeBuffer