
Issue #21025 has been updated by deivid (David RodrÃguez). Cool, thanks for the info, I'll create a PR to improve the documentation. ---------------------------------------- Misc #21025: What's the default encoding of `String.new`? https://bugs.ruby-lang.org/issues/21025#change-111432 * Author: deivid (David RodrÃguez) * Status: Open ---------------------------------------- In the documentation (https://docs.ruby-lang.org/en/3.4/encodings_rdoc.html#label-String+Encoding) I see a good explanation of default string encodings:  However, it does not mention `String.new` without an argument, which is the one case where I see inconsistent behavior. ``` irb(main):001> "".encoding => #<Encoding:UTF-8> irb(main):002> String.new("").encoding => #<Encoding:UTF-8> irb(main):003> String.new(a="").encoding => #<Encoding:UTF-8> irb(main):004> String.new.encoding => #<Encoding:BINARY (ASCII-8BIT)> ``` Should this be documented or changed? ---Files-------------------------------- Captura de pantalla 2025-01-10 a las 17.53.06.png (139 KB) -- https://bugs.ruby-lang.org/