• Invalid content encoding

Question related to mission Bit Message

 

I had real struggle with this task. The main problem was with the content encoding (not packing).

The task says nothing about the content except it is unicode and BitMessage content are characters - that's nonsense. BitMessage is a stream of data, not characters. Characters needs to be encoded (utf-8, 16, 32) and you need to know the encoding to decode properly.

Straight solution leads to str.decode() function - which doesn't work for obvious reasons: 1) 7bit packing leads to single bytes plus utf8 2) 8bit packing leads to single bytes padded with 0 plus utf16 30 16bit packing leads to pairs of bytes plus utf16

After finding the proper way I am sure the message content gets encoded wrong: 1) take character and get it's ordinal 2) fit the value in 7/8/16 packing format 3) close your eyes and hope the value fits in

If any of characters reaches 2^|pack| ordinal value, the format will corrupt the message. As this format is suitable for the task itself, it is confusing and violates Unicode specifications. I'm quite experienced in this area, and maybe that's reason I struggled so much here. The solution would be either: a) use proper encoding - str.encode() not char by char encoding b) give a clue that content is not valid unicode, rather an ordinal that miraculously fits into current packing

Also, in Output description, you call content as message which is confusing (that's the first spot in description you're calling it message).

Btw, as I'm exposing some information for the solution of task, I have no problem if author removes this post after reading it.

Thanks, Tomas

22