I try to run a rails app (Airesis), using apache2 and passenger. The erb files contain UTF-8 encoded characters. I see
Encoding::CompatibilityError (incompatible character encodings: ASCII-8BIT and UTF-8):
errors, corresponding to lines in the erb containing utf-8 encoded characters. Interestingly another machine with the exact same setup up from rvm does not have this issue. The only difference we could identify that the working machine had hu_HU.UTF-8 as the default locale, as the non-working had C. But the problem did not go away after changing the system locale.
Tried to specify
<% # -*- coding: UTF-8 -*- %>
In the beginning of the erb file, checked that the Application class have
config.encoding = "utf-8"
added
Encoding.default_external = "UTF-8"
to the beginning of config/application.rb, added
export RUBYOPT=-Ku
to /etc/default/apache2, and
SetEnv RUBYOPT=-Ku
to the apache config file.
None of them solved the problem.
I use apache2, and all ruby related things, including passenger installed using rvm by root. Versions: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux] Rails 4.0.2 passenger 4.0.56
Any help is appreciated.