def _encode_url(url):
 data = bytes(QUrl.toPercentEncoding(url.toString(), ':/#?&+=@%*'))
 return data.decode('ascii')

def _encode_url ( url ) : data = bytes ( QUrl . toPercentEncoding ( url . toString ( ) , ':/#?&+=@%*' ) ) return data . decode ( 'ascii' )
encode a qurl suitable to pass to qwebhistory .