VE-1463: Encode endpoint URI

Unlike WMF we pass to Parsoid not a symbolic name pointing to a wiki, but entire URL to api.php. That URL has to be encoded, and currently we were doing it properly in MediaWiki but not in Parsoid itself (in case when Parsoid calls Parsoid :)).
Inconsistent spaces