Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
ambicapter
· 10y ago · 0 comments
I don't understand this encoding method. If say, a dictionary starts with d and ends with e, how do you know with "d3:key5:valuee" if the value is "value" or "valu"?
Comments
[–]
sigcode
10y ago
http://cr.yp.to/proto/netstrings.txt
(1997)
[–]
robteix
10y ago
Because the value is actually "5:value", which means it's 5 bytes long. The final 'e' indicates the end of the dictionary, not the value.
[–]
nemaar
10y ago
The length of the string is included, so you know where it ends.