core: better support for Python 3.x on Windows

Encode the command-line later to avoid mixing bytes and str on Python3.

Signed-off-by: David Aguilar <davvid@gmail.com>