28 Dezember 2006

Ruby on Rails and ä,ö,ü etc

If you need "Umlaute" in Ruby on Rails you can use the following filter
in the ApplicationController:


class
ApplicationController < ActionController::Base
before_filter :charset
def charset
if request.xhr?
@response.headers["Content-Type"] ||=
"
text/javascript; charset=iso-8859-1"

else
@response.headers["Content-Type"] ||=
"text/html; charset=iso-8859-1"
end
end
end

1 Kommentar:

Simon hat gesagt…

Great! That was exactly what I was looking for.