You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a bencode input "li1ei2el3:stree", I get [1 2 [#object["[B" 0x5351baec "[B@5351baec"]]] Note: the input was created using write-bencode and seems correct with respect to the spec
So, after investigating this issue, I found some magic performed in the test: the function <bytes. As I understand it, it transforms the raw bytes that were decoded into beautiful UTF-8 strings. As I am writing this, it seems completely legit, because the string can have any charset.
Though I just discovered this library, I would say that converting every byte-array to an original string form is quite common. I would gladly appreciate a nice utility function to convert all those bytes to string, using a custom function.
I see that it applies to both bencode and netstring.
What do you think?
Activity
Kineolyan commentedon Nov 7, 2021
A quick check showed that this is not an issue for nested maps.
Kineolyan commentedon Nov 9, 2021
So, after investigating this issue, I found some magic performed in the test: the function
<bytes. As I understand it, it transforms the raw bytes that were decoded into beautiful UTF-8 strings. As I am writing this, it seems completely legit, because the string can have any charset.Though I just discovered this library, I would say that converting every byte-array to an original string form is quite common. I would gladly appreciate a nice utility function to convert all those bytes to string, using a custom function.
I see that it applies to both
bencodeandnetstring.What do you think?
bencode/test/bencode/core_test.clj
Lines 23 to 41 in 4286cee