1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

rails Shift_JISの日本語パラメータを受け取る

Last updated at Posted at 2021-06-30

課題

ActionController::BadRequest: Invalid request parameters: Invalid encoding for parameter:

が発生した。
外部APIのレスポンスにShift_JISの日本語が入っていた。

解決

param_encodingを使う

検索結果

doc

sample

class SampleController < ActionController::Base 
 param_encoding :action_name, :param_name, Encoding::Shift_JIS
 
 def action_name
 end
end
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?