Your encoder implementation is not specification-compliant in that it does not sort dictionary entries.
Keys must be strings and appear in sorted order (sorted as raw strings, not alphanumerics).
Note that, in the context of bencoding, strings, including dictionary keys, are arbitrary byte sequences (uint8_t[]).
See webtorrent/node-bencode#142.