Decoding a string directly to a buffer and vice-versa.
Decoding a string directly to a buffer and vice-versa.
(decode buffer)(decode buffer decoder)Interprets the given `buffer` as a string. Defaults to UTF-8. See [[decoder]].
(decoder encoding)A decoder knows how to translate a buffer into a string given an encoding.
Supported cross-platform encodings are:
"iso-8859-1" "utf-8" "utf-16be" "utf-16le"
Other encodings are platform dependent. On the JVM, it can be anything accepted
by the Charset class while in JS it can be anything accepted by a TextDecoder.
Throws if the encoding is not supported.
A decoder knows how to translate a buffer into a string given an encoding. Supported cross-platform encodings are: "iso-8859-1" "utf-8" "utf-16be" "utf-16le" Other encodings are platform dependent. On the JVM, it can be anything accepted by the `Charset` class while in JS it can be anything accepted by a `TextDecoder`. Throws if the encoding is not supported.
Default decoder used by this library (UTF-8).
Default decoder used by this library (UTF-8).
(encode string)(encode string encoder)(encode string)Returns a buffer containing the given string encoded in UTF-8.
On the JVM, an alternative encoder can be provided (see encoder).
Returns a buffer containing the given `string` encoded in UTF-8. On the JVM, an alternative encoder can be provided (see [[encoder]]).
(encoder encoding)An encoder knows how to translate into a buffer a string encoded in a given encoding.
In JS, strings can only be encoded as UTF-8 which is why string encoding utilities from this library use exclusively UTF-8.
However, on the JVM, any encoding can be used in encode.
See decoder for available encodings.
An encoder knows how to translate into a buffer a string encoded in a given encoding. In JS, strings can only be encoded as UTF-8 which is why string encoding utilities from this library use exclusively UTF-8. However, on the JVM, any encoding can be used in [[encode]]. See [[decoder]] for available encodings.
Default encoder used by this library (UTF-8).
Default encoder used by this library (UTF-8).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |