encoding - How to bencode non-ascii strings and non-integer numbers? -


according bencoding specification:

bencoded strings encoded follows: <string length encoded in base ten ascii>:<string data>, or key:value note there no constant beginning delimiter, , no ending delimiter.

example: 4:spam represents string "spam"
example: 0: represents empty string ""

integers encoded follows: i<integer encoded in base ten ascii>e initial i , trailing e beginning , ending delimiters. can have negative numbers such i-3e. significant digits should used, 1 cannot pad integer zeroes. such i04e. however, i0e valid.

example: i3e represents integer "3"


my questions:

question 1: how should bencode string non-ascii characters? example: mûrier or die höhe zeit shall convert such string sequence of bytes, using utf-8 encoding, or one? , how apply specification?

question 2: how bencode non-integer number, example 1.0002910 or -0.0049172?

  1. from spec, "all character string values utf-8 encoded."
  2. not covered spec; apparently not needed.

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -