From: "naruse (Yui NARUSE) via ruby-core" Date: 2026-11-10T07:02:33+00:00 Subject: [ruby-core:127402] [Ruby Feature#22244] `ruby -UU` should set both internal and external, `ruby -E` should print encoding list Issue #22244 has been updated by naruse (Yui NARUSE). I'm not sure about a situation you emulate with `env -u LANG`. > --help doesn't list -U. (The man page does) Usually with LANG environment variable, it is automatically set. Another reason is that matz says `--help` should be shown in 1 page. > --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 -E could just print them all out. If you set LANG environment variable correctly for example `LANG=en_US.UTF-8`, you don't need to use -U and -E. I don't think there is a reason to recommendd such an indirect approach. > WHY NOT take UTF8 or UTF_8 (since that's the class name)? UTF-8 is the canonical name of the IANA charset. LANG environment variable also accept for example `en_US.UTF-8`. If you have a certain situation or context when ruby should accept UTF8 or UTF_8, they are added as an alias. > Please consider -UU to mean -EUTF-8:UTF-8 internal encoding is for automatic encoding conversion. It introduces another complexity for an application. Usually modern application should be design without encoding conversion. Therefore I don't think there is enough needs for adding -UU. ---------------------------------------- Feature #22244: `ruby -UU` should set both internal and external, `ruby -E` should print encoding list https://bugs.ruby-lang.org/issues/22244#change-119846 * Author: zenspider (Ryan Davis) * Status: Open ---------------------------------------- ``` 10004 $ env -u LANG ruby -U -e 'pp [Encoding.default_internal, Encoding.default_external]' [#, #] 10005 $ env -u LANG ruby -EUTF-8 -e 'pp [...]' [nil, #] 10006 $ env -u LANG ruby -EUTF-8 -U -e 'pp [...]' [#, #] 10007 $ env -u LANG ruby -EUTF-8:UTF-8 -e 'pp [...]' [#, #] 10008 $ env -u LANG ruby -UU -e 'pp [...]' [#, #] ``` I think the option processing of encodings is VERY poorly documented and frustrating to try to use. 1. --help doesn't list -U. (The man page does) 2. --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 -E` could just print them all out. 3. WHY NOT take UTF8 or UTF_8 (since that's the class name)? 4. Please consider `-UU` to mean `-EUTF-8:UTF-8` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/