I'm trying to figure out what encodings are available in node.js.
The documentation (http://nodejs.org/api/buffer.html#buffer_new_buffer_str_encoding) says:
Allocates a new buffer containing the given str. encoding defaults to 'utf8'.
but nowhere is specified a list of available encodings. Maybe I missed it.
I'm working on script which should be able to output in wide range of encodings. So far I know only about utf8 as doc is saying :)
Thx, Jaro.
Encodings available in Node.js:
ascii
: For 7-bit ASCII data only. This encoding is fast and will strip the high bit if set.utf8
: Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.utf16le
: 2 or 4 bytes, little-endian encoded Unicode characters. Surrogate pairs (U+10000 to U+10FFFF) are supported.ucs2
: Alias ofutf16le
.base64
: Base64 encoding. When creating a Buffer from a string, this encoding will also correctly accept "URL and Filename Safe Alphabet" as specified in RFC 4648, Section 5.latin1
: A way of encoding the Buffer into a one-byte encoded string (as defined by the IANA in RFC 1345, page 63, to be the Latin-1 supplement block and C0/C1 control codes).binary
: Alias for 'latin1'.hex
: Encode each byte as two hexadecimal characters.
Source: Node 12 Buffer documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With