Actions
Feature #22244
open`ruby -UU` should set both internal and external, `ruby -E` should print encoding list
Feature #22244:
`ruby -UU` should set both internal and external, `ruby -E` should print encoding list
Status:
Open
Assignee:
-
Target version:
-
Description
10004 $ env -u LANG ruby -U -e 'pp [Encoding.default_internal, Encoding.default_external]'
[#<Encoding:UTF-8>, #<Encoding:US-ASCII>]
10005 $ env -u LANG ruby -EUTF-8 -e 'pp [...]'
[nil, #<Encoding:UTF-8>]
10006 $ env -u LANG ruby -EUTF-8 -U -e 'pp [...]'
[#<Encoding:UTF-8>, #<Encoding:UTF-8>]
10007 $ env -u LANG ruby -EUTF-8:UTF-8 -e 'pp [...]'
[#<Encoding:UTF-8>, #<Encoding:UTF-8>]
10008 $ env -u LANG ruby -UU -e 'pp [...]'
[#<Encoding:UTF-8>, #<Encoding:US-ASCII>]
I think the option processing of encodings is VERY poorly documented and frustrating to try to use.
- --help doesn't list -U. (The man page does)
- --help for -E doesn't provide a means to get a list of available encoding names (same with manpage), leading me to try U, UTF8, UTF_8, before finding UTF-8.
ruby -Ecould just print them all out. - WHY NOT take UTF8 or UTF_8 (since that's the class name)?
- Please consider
-UUto mean-EUTF-8:UTF-8
Updated by zenspider (Ryan Davis) 1 day ago
Quick and dirty patch: https://github.com/ruby/ruby/compare/master...zenspider:ruby:zenspider__encodings?expand=1
This is rough. I'm faking an eval early in the option handling. There is probably a better C way to do this. It is probably failing tests.
But the idea is there.
Updated by zenspider (Ryan Davis) 1 day ago
PR is being worked down with feedback from @nobu (Nobuyoshi Nakada)
https://github.com/ruby/ruby/pull/18319
:heart:
Actions