Issue #14077 has been updated by shevegen (Robert A. Heiler).


I am in agreement with the feature-suggestion. Not sure whether
it should be a constant or a method or both but I agree that it
may be useful to have direct support for this in ruby.

> Even changing the $LANG environment variable within the Ruby
> process doesn't seem to affect the value for these special
> encodings.

You mean you used ENV['LANG']? Manipulating ENV works for me
for other variables at the least such as CFLAGS and so forth.

Perhaps there may be a reason why there is no direct support,
nobu may perhaps know more - they probably sleep right now in
japan at 03:32 ... :)

rrroybbbean wrote:

> It's small innovations like this that have made Ruby into
> an awesome programming experience.

Yes - please do not forget the documentation for it though!
Since others rely on documentation.

Matz said several times that one (core?) part of ruby's philosophy
is the "human aspect" aka how something is used with ruby. I think
that  this is also a reason why the ruby core team often likes
to see "real world use cases" to determine how/if something is
used.

----------------------------------------
Feature #14077: Add Encoding::FILESYSTEM and Encoding::LOCALE constants
https://bugs.ruby-lang.org/issues/14077#change-67686

* Author: nirvdrum (Kevin Menard)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
The `Encoding` class has constants defined for all of the standard encodings, but does not have constants defined for some of the special encodings. In particular, the "filesystem" and "locale" encodings do not have a corresponding `Encoding::FILESYSTEM` and `Encoding::LOCALE`. As a result, every time they need to be used they must be looked up using `Encoding.find`. As far as I can tell, neither of these special encodings can change after the Ruby process has been started up. Even changing the `$LANG` environment variable within the Ruby process doesn't seem to affect the value for these special encodings.

Therefore, I'm proposing the introduction of `Encoding::FILESYSTEM` and `Encoding::LOCALE` constants both as a matter of consistency and as a matter of efficiency.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>