Fix bytes encoding bug between Python 2 and 3
Fix bytes encoding bug between Python 2 and 3

In Python 2, `str.encode()` returns an encoded `str`ing object, while in Python
3, the same call returns a `bytes` object. This mismatch causes display issues
on the "View Raw Markdown" page.

airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo