Fix #encode to include spaces to separate pairs