error_char

ecerr.error_char â string
Instance Public methods

Returns the one-character string which cause Encoding::UndefinedConversionError.

ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP")
begin
  ec.convert("\xa0")
rescue Encoding::UndefinedConversionError
  puts $!.error_char.dump   #=> "\xC2\xA0"
  p $!.error_char.encoding  #=> #<Encoding:UTF-8>
end
doc_ruby_on_rails
2015-04-04 20:38:22
Comments
Leave a Comment

Please login to continue.