0

I want to send this word "Réfugié"to the site, but when I send it with the UTF-8 encode I don't get the result ('r\xc3\xa9fugi\xc3\xa9')

But the string must be correct ('r\xe9fugi\xe9').

How can I do that? I tried using string and the encoding and encoding for UTF-8 did not work. Latin-1 did not work either.

martineau
  • 119,623
  • 25
  • 170
  • 301
  • Show us some code you've tried. Also, maybe look at `urllib` (depending on your version, maybe `urllib.parse`) for `urlencode` and associated `quote` or `quote_plus` functions; you can define how the "POST" parems are encoded to support HTTP/1.1 standards. – pstatix Jun 01 '17 at 03:30
  • # -*- coding: latin1 -*- import requests url = "http://www.website.com/chercher/" search_word = "réfugié" payload = {'q' : search_word} r = requests.post(url, data=payload) – Mostafa Mohamed Jun 01 '17 at 03:33

0 Answers0