#NEWLINE# def urlencode_utf8( params ) : #NEWLINE# #INDENT# '\n    UTF-8 safe variant of urllib.urlencode.\n    http://stackoverflow.com/a/8152242\n    ' #NEWLINE# if hasattr ( params , 'items' ) : #NEWLINE# #INDENT# params = params . items ( ) #NEWLINE# #UNINDENT# params = ( '=' . join ( ( urllib . quote_plus ( k . encode ( 'utf8' ) , safe = '/' ) , urllib . quote_plus ( v . encode ( 'utf8' ) , safe = '/' ) ) ) for ( k , v ) in params ) #NEWLINE# return '&' . join ( v )