-
Notifications
You must be signed in to change notification settings - Fork 18
Description
As of Node 18, there are 3 encodings that are simply aliases to another:
binaryis an alias forlatin1-
See binary strings for more background on this topic. The name of this encoding can be very misleading, as all of the encodings listed here convert between strings and binary data. For converting between strings and Buffers, typically 'utf8' is the right choice.
-
ucs2anducs-2are both aliases toutf16le.asciiis an alias in one direction but not another:-
For 7-bit ASCII data only. When encoding a string into a Buffer, this is equivalent to using 'latin1'. When decoding a Buffer into a string, using this encoding will additionally unset the highest bit of each byte before decoding as 'latin1'. Generally, there should be no reason to use this encoding, as 'utf8' (or, if the data is known to always be ASCII-only, 'latin1') will be a better choice when encoding or decoding ASCII-only text. It is only provided for legacy compatibility.
-