I'm getting this error, but only on production, and only when editing a specific record. It doesn't happen in development, and it doesn't happen for any other record. Not only that, but there are no UTF characters in the template, no UTF characters in en.yml
, and the record also has no UTF characters either! I can view/show the record fine.
272 <158>1 2017-10-16T16:57:50.349003+00:00 host heroku router - at=info method=GET path="/users/26/edit" host=www.host.net request_id=6d8d22cc-3050-4628-85a4-f660991b4ce3 fwd="99.99.99.99" dyno=web.1 connect=4ms service=442ms status=500 bytes=1733 protocol=https
145 <190>1 2017-10-16T16:57:50.345615+00:00 host app web.1 - F, [2017-10-16T16:57:50.344992 #4] FATAL -- : [6d8d22cc-3050-4628-85a4-f660991b4ce3]
228 <190>1 2017-10-16T16:57:50.345696+00:00 host app web.1 - F, [2017-10-16T16:57:50.345626 #4] FATAL -- : [6d8d22cc-3050-4628-85a4-f660991b4ce3] ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
173 <190>1 2017-10-16T16:57:50.346033+00:00 host app web.1 - F, [2017-10-16T16:57:50.345973 #4] FATAL -- : [6d8d22cc-3050-4628-85a4-f660991b4ce3] 55: .input-group
150 <190>1 2017-10-16T16:57:50.346035+00:00 host app web.1 - [6d8d22cc-3050-4628-85a4-f660991b4ce3] 56: - us = Country.find_by code: 'US'
237 <190>1 2017-10-16T16:57:50.346036+00:00 host app web.1 - [6d8d22cc-3050-4628-85a4-f660991b4ce3] 57: =cf.collection_select :country_id, [us] + Country.all, :id, :name, {prompt: t('company.country')}, class: 'form-control'
146 <190>1 2017-10-16T16:57:50.346037+00:00 host app web.1 - [6d8d22cc-3050-4628-85a4-f660991b4ce3] 58: .input-group-addon.required *
143 <190>1 2017-10-16T16:57:50.346038+00:00 host app web.1 - [6d8d22cc-3050-4628-85a4-f660991b4ce3] 59: .card-header= t 'company.financials'
118 <190>1 2017-10-16T16:57:50.346039+00:00 host app web.1 - [6d8d22cc-3050-4628-85a4-f660991b4ce3] 60: .card-block
119 <190>1 2017-10-16T16:57:50.346040+00:00 host app web.1 - [6d8d22cc-3050-4628-85a4-f660991b4ce3] 61: .card-text
145 <190>1 2017-10-16T16:57:50.346087+00:00 host app web.1 - F, [2017-10-16T16:57:50.346035 #4] FATAL -- : [6d8d22cc-3050-4628-85a4-f660991b4ce3]
259 <190>1 2017-10-16T16:57:50.346213+00:00 host app web.1 - F, [2017-10-16T16:57:50.346100 #4] FATAL -- : [6d8d22cc-3050-4628-85a4-f660991b4ce3] app/views/companies/_edit.haml:58:in `block in _app_views_companies__edit_haml___3739913582972992033_70135683358520'
The HAML is
.input-group
- us = Country.find_by code: 'US'
=cf.collection_select :country_id, [us] + Country.all, :id, :name, {prompt: t('company.country')}, class: 'form-control'
.input-group-addon.required *
Countries does not have any UTF characters except for 'Saint-Barthélemy' and 'São Tomé and Príncipe'. However I can still edit other records and list all countries fine.
I tried the solutions in
- ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT) (I'm not using
request
.) - incompatible character encodings: ASCII-8BIT and UTF-8 (I have no UTF in the template.)
- Error: Incompatible character encodings: UTF-8 and ASCII-8BIT (I set NLS_LANG=AMERICAN_AMERICA.UTF8.)
None of them worked. I also tried
class Application < Rails::Application
config.encoding = "utf-8"
I am using Heroku, Postgres, HAML, and Rails 5.0.6.