From: "andrykonchin (Andrew Konchin)" Date: 2022-10-27T19:32:06+00:00 Subject: [ruby-core:110525] [Ruby master Misc#19088] Complex() method with `exception: false` option still raises exception when String argument is in non-ASCII-compatible encoding Issue #19088 has been reported by andrykonchin (Andrew Konchin). ---------------------------------------- Misc #19088: Complex() method with `exception: false` option still raises exception when String argument is in non-ASCII-compatible encoding https://bugs.ruby-lang.org/issues/19088 * Author: andrykonchin (Andrew Konchin) * Status: Open * Priority: Normal ---------------------------------------- I've noticed a minor inconsistency of the `Complex()` method. When it is called with `exception: false` option I suppose it shouldn't raise any exception. For instance it doesn't raise error in the following cases: ```ruby Complex("1+2ifoobar", exception: false) # => nil Complex("1+2i\0", exception: false) # => nil ``` But it still raises error when argument is in non-ASCII-compatible encoding: ```ruby Complex("1+2i".encode("UTF-16"), exception: false) (irb):4:in `Complex': ASCII incompatible encoding: UTF-16 (Encoding::CompatibilityError) ``` I am wondering if `exception: false` is supposed to suppress and this exception as well. -- https://bugs.ruby-lang.org/ Unsubscribe: