Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Encoding.default_internal
() -> ::Encoding?
Encoding.default_internal → enc
encoding.c
View on GitHub ↗
static VALUE
get_default_internal(VALUE klass)
{
return rb_enc_default_internal();
}
Returns default internal encoding. Strings will be transcoded to the default internal encoding in the following places if the default internal encoding is not nil:
-
CSV
-
Filedata read from disk -
Strings returned from Readline
-
Strings returned from SDBM
-
Values from
ENV -
Values in ARGV including $PROGRAM_NAME
Additionally String#encode and String#encode! use the default internal encoding if no encoding is given.
The script encoding (__ENCODING__), not default_internal, is used as the encoding of created strings.
Encoding::default_internal is initialized with -E option or nil otherwise.
See also
.default_internal=
.default_external=
.default_external
.find
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0