def encode_unicode_characters_in_url(url):
 (scheme, netloc, path, params, query, fragment) = urlparse(url)
 query_params = parse_qsl(query)
 updated_query_params = []
 for (query_name, query_val) in query_params:
  updated_query_params.append((query_name, urlquote(query_val)))
 return urlunparse((scheme, netloc, urlquote(path, '/:+@'), params, urlencode(query_params), fragment))

def encode_unicode_characters_in_url ( url ) : ( scheme , netloc , path , params , query , fragment ) = urlparse ( url ) query_params = parse_qsl ( query ) updated_query_params = [ ] for ( query_name , query_val ) in query_params : updated_query_params . append ( ( query_name , urlquote ( query_val ) ) ) return urlunparse ( ( scheme , netloc , urlquote ( path , '/:+@' ) , params , urlencode ( query_params ) , fragment ) )
encodes all unicode characters to their percent-encoding representation in both the path portion and query parameter portion of the given url .