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) about 1 year ago. Updated about 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 #1

Updated by byroot (Jean Boussier) about 1 year ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: UNKNOWN
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|c30cab8ce4d2ab21ef75e2a3218cb76b21d78407.


[Bug #19570] Propagate message encoding to decorated message

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0