Project

General

Profile

Actions

Bug #19570

closed

`Exception#full_message` raises an `EncodingError` if the exception contains UTF8 characters after a newline and `Exception#cause` contains UTF8 characters

Added by timothy.willard (Timothy Willard) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:113087]

Description

e = begin
  begin
    raise "Übersicht"
  rescue => e
    raise "\n#{e.message}"
  end
rescue => e
  e
end
e.full_message

will reproduce the error with the exception incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError).

In this case, all of e.message, e.cause.message and e.cause.detailed_message have a UTF-8 encoding, but e.detailed_message has an ASCII-8BIT encoding. I think the issue is related to this line (possibly caused by the encoding differences between write_warn2 used here and here in the newline case vs write_warn_str used here in the no-newline case.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0