Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Encoding::Converterクラス > replacement=

instance method Encoding::Converter#replacement=

replacement=(string)[permalink][rdoc]

置換文字を設定します。

[PARAM] string:
変換器に設定する置換文字

ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace)
ec.replacement = "<undef>"
p ec.convert("a \u3042 b")      #=> "a <undef> b"