class YourController < ApplicationController
after_action :change_charset_to_sjis, only: [:index]
def index
end
private
def change_charset_to_sjis
headers["Content-Type"] = 'text/html; charset=Shift_JIS'
response.body = response.body.encode(Encoding::SHIFT_JIS)
end
end
Created
December 8, 2016 10:38
-
-
Save bluerabbit/8b0aa17a1a75819972e693b11d1e9cea to your computer and use it in GitHub Desktop.
Railsで文字エンコードShift-JISでレンダリングする方法
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment