title: Mimic Javascript escape() function
body: <p>As shown in this table <a href="http://www.javascripter.net/faq/accentedcharacters.htm" rel="nofollow noreferrer">http://www.javascripter.net/faq/accentedcharacters.htm</a>, there's a difference between <code>escape()</code> and <code>encodeURI()</code>.</p>
  
  <p>I need to mimic the behavior of <code>escape()</code>, as it's needed by another system, but turns out is complicated with Python.</p>
  
  <pre><code>msg = "¿El mañana exitirá?"
  
  # javascript: console.log(escape(msg)) # %BFEl%20ma%F1ana%20exitir%E1%3F
  q = urllib.parse.quote(msg)
  print(q) # %C2%BFEl%20ma%C3%B1ana%20exitir%C3%A1%3F
  
  q = urllib.parse.quote(msg, encoding="unicode_escape")
  print(q) # %5CxbfEl%20ma%5Cxf1ana%20exitir%5Cxe1%3F
  </code></pre>
  
  <p>How can I make Python mimic <code>escape</code>?</p>