Forum: Ruby on Rails Using unicode_hacks breaks Rails 1.1 RJS

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Zak M. (Guest)
on 2006-04-23 22:38

I wasted an hour on this, so here's a quick post to save you from the
same. If you are using
for "multi-lingual
(i18n), there's a gotcha - RJS templates will not work.

The culprit is line #4 in lib\actionpack_filters.rb, which sets the
character set in the HTTP header to UTF so that old browsers can render
the properly. It also sets the content-type to text/html. For RJS, the
content-type needs to be text/javascript.

Here's a quick fix that worked for me, replace line #4 with

response.headers["Content-Type"] = "text/html; charset=utf-8" if not

- Zak
This topic is locked and can not be replied to.