Method: Encoding::InvalidByteSequenceError#error_bytes
- Defined in:
- transcode.c
#error_bytes ⇒ String
Returns the discarded bytes when Encoding::InvalidByteSequenceError occurs.
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
4386 4387 4388 4389 4390 |
# File 'transcode.c', line 4386 static VALUE ecerr_error_bytes(VALUE self) { return rb_attr_get(self, id_error_bytes); } |