Closed kul closed 10 years ago
I guess this would be equivalent to (.getBytes (String. ....)) and every binary data can not be represented in utf-8. Closing this.
Hi Kul, could you describe a little what you're actually trying to do?
Nippy's freeze
fn returns a Java byte array. Bytes themselves aren't "encoded". Encodings come in to play when you're transforming something to/from a byte array and there may be more than one way of doing the transformation.
A String is a good example:
"hello" ; String with some kind of character encoding (usu. UTF-8)
(.getBytes "hello" "UTF-8") ; The byte form of our UTF-8 String
(String. (.getBytes "hello" "UTF-8") "UTF-8") ; Rebuilding the original String
The Bytes/toString
method that you're calling seems to be designed to operate on the byte form of a UTF-8 String. Not on an arbitrary byte array (like the kind Nippy's freeze
fn will return).
Probably you won't need/want to use these byte utilities when operating with Nippy, but that might depend on what you're trying to do exactly.
Does that make sense?
Yes makes perfect sense. Sorry for this.
Thanks
No problem :-) Cheers!
What is the default encoding for bytes with nippy?
I get following errors when working with this API which assumes UTF-8.