Skip to main content

Encoding.default

Encoding.default

Documentation

A default encoding that will try to guess the encoding based on some heuristics. If a BOM is present, it will be used to determine UTF-8 or UTF-16 encoding. Otherwise, the input is decoded using UTF-8 unless it contains invalid UTF-8 sequences, in which case Windows-1252 is used as a fallback. When used for encoding, it will either use the same encoding detection heuristics as in read in case of Append mode. When writing a new file, it will always use UTF-8. This encoding cannot be passed to some functions that require a Java Charset.