class method
Encoding.default_external
() -> ::Encoding
Encoding.default_external → enc
encoding.c
View on GitHub ↗
static VALUE
get_default_external(VALUE klass)
{
return rb_enc_default_external();
}
Returns default external encoding.
The default external encoding is used by default for strings created from the following locations:
-
CSV
-
Filedata read from disk -
SDBM
While strings created from these locations will have this encoding, the encoding may not be valid. Be sure to check String#valid_encoding?.
File data written to disk will be transcoded to the default external encoding when written, if default_internal is not nil.
The default external encoding is initialized by the -E option. If -E isn’t set, it is initialized to UTF-8 on Windows and the locale on other operating systems.
Ruby version changes
-
3.0
-
Changed default for
Encoding.default_externalto UTF-8 on Windows [Feature #16604]
-
See also
.default_external=
.compatible?
.aliases
.default_internal
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0