You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A method what is named with an encoding what is incompatible with Encoding.default_external causes crash #52
changed the title [-]A method what is named with an encoding what is different from `Encoding.default_external` causes crash[/-][+]A method what is named with an encoding what is incompatible with `Encoding.default_external` causes crash[/+]on Jan 9, 2020
IMO it's unreasonable and pointless to define a method with a UTF-16 name, see truffleruby/truffleruby#4005 (comment).
I think CRuby should actually prevent defining such a method in a dummy (Encoding::UTF_16) or ASCII-incompatible encoding (Encoding::UTF_16LE/Encoding::UTF_16BE).
I think CRuby should actually prevent defining such a method in a dummy (Encoding::UTF_16) or ASCII-incompatible encoding (Encoding::UTF_16LE/Encoding::UTF_16BE).
What would you like to see?
A particular exception thrown?
And Ruby only supports sources in ASCII-compatible encodings:
$ ruby -e '# encoding: utf-16le'
-e:1: UTF-16LE is not ASCII compatible (ArgumentError)
So I think either an ArgumentError or maybe Encoding::CompatibilityError when define_method receives a name in an ASCII-incompatible encoding.
For example filesystem operations reject such ASCII-incompatible encodings:
irb(main):004> File.read("abc".encode(Encoding::UTF_16LE))
(irb):4:in `read': path name must be ASCII-compatible (UTF-16LE): "abc" (Encoding::CompatibilityError)
from (irb):4:in `<main>'
from <internal:kernel>:187:in `loop'
from /home/eregon/.rubies/ruby-3.3.5/lib/ruby/gems/3.3.0/gems/irb-1.13.1/exe/irb:9:in `<top (required)>'
from /home/eregon/.rubies/ruby-3.3.5/bin/irb:25:in `load'
from /home/eregon/.rubies/ruby-3.3.5/bin/irb:25:in `<main>'
Activity
[-]A method what is named with an encoding what is different from `Encoding.default_external` causes crash[/-][+]A method what is named with an encoding what is incompatible with `Encoding.default_external` causes crash[/+]fix: don't crash on utf18 autocompletion
fix: don't crash on utf18 autocompletion
fix: don't crash on utf18 autocompletion
fix: don't crash on utf18 autocompletion
fix: don't crash on utf18 autocompletion
fix: don't crash on utf18 autocompletion
fix: don't crash on utf18 autocompletion
Fix UTF-16 autocompletion
eregon commentedon Oct 27, 2025
IMO it's unreasonable and pointless to define a method with a UTF-16 name, see truffleruby/truffleruby#4005 (comment).
I think CRuby should actually prevent defining such a method in a dummy (Encoding::UTF_16) or ASCII-incompatible encoding (Encoding::UTF_16LE/Encoding::UTF_16BE).
alexanderadam commentedon Oct 27, 2025
What would you like to see?
A particular exception thrown?
Fix UTF-16 autocompletion
eregon commentedon Oct 28, 2025
All 3 UTF-16 encodings are ASCII-incompatible:
And Ruby only supports sources in ASCII-compatible encodings:
So I think either an ArgumentError or maybe Encoding::CompatibilityError when
define_methodreceives a name in an ASCII-incompatible encoding.For example filesystem operations reject such ASCII-incompatible encodings:
Fix UTF-16 autocompletion (#1129)
update test to check for UTF16/LE/BE
update test to check for UTF16/LE/BE
update test to check for UTF16LE
update test to check for UTF16LE
update test to check for UTF16LE (#1132)