From: "Eregon (Benoit Daloze)" Date: 2022-11-21T13:47:31+00:00 Subject: [ruby-core:110834] [Ruby master Bug#19108] Format routines like pack blindly treat a string as ASCII-encoded Issue #19108 has been updated by Eregon (Benoit Daloze). Agreed, I think it should be ArgumentError since it's otherwise silently ignoring characters in the pack format string. A non-verbose warning is better than the current state if ArgumentError is deemed too incompatible. Here is real case where the silent warning caused confusion for `[1].pack(' # p ['foo'].pack('u'.encode('UTF-32BE')).encoding # => # ``` This is because the NUL characters in the second one (which aren't really NUL characters - they're part of the directive characters) explicitly trigger the encoding to change to binary. There is a warning, but the warning is only for unexpected directives. How about disallowing or warning for non-ascii compatible format strings? -- https://bugs.ruby-lang.org/ Unsubscribe: