instance method Encoding::InvalidByteSequenceError#error_bytes

error_bytes -> String[permalink][rdoc]

エラー発生時に捨てられたバイト列を返します。

ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
  ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
  p $!
  #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
  puts $!.error_bytes.dump          #=> "\xA1"
  puts $!.readagain_bytes.dump      #=> "\xFF"
end

[SEE_ALSO] Encoding::InvalidByteSequenceError#readagain_bytes