Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>[big fat comment because comments can't be formatted well]</p> <p>Following the instructions of @Boaz Yaniv works for me:</p> <pre><code>&gt;&gt;&gt; addressString = 'Wilhelmstra\xc3\x9fe 123, T\xc3\xbcbingen, Deutschland' </code></pre> <p>That's a <code>str</code> ojbject, encoded in UTF-8. We need to percent-escape it so that it can be used in a URL.</p> <pre><code>&gt;&gt;&gt; import urllib &gt;&gt;&gt; fixed = urllib.quote(addressString) &gt;&gt;&gt; print repr(fixed) 'Wilhelmstra%C3%9Fe%20123%2C%20T%C3%BCbingen%2C%20Deutschland' </code></pre> <p>Now let's try it out:</p> <pre><code>&gt;&gt;&gt; url = "http://maps.googleapis.com/maps/api/geocode/json?address=" + fixed + "&amp;sensor=false" &gt;&gt;&gt; guff = urllib.urlopen(url).read() &gt;&gt;&gt; import json &gt;&gt;&gt; print repr(json.loads(guff)['results'][0]['formatted_address']) u'Wilhelmstra\xdfe 123, 72074 T\xfcbingen, Germany' &gt;&gt;&gt; </code></pre> <p>If you have something like this: <code>'Wilhelmstra\xdfe 123, T\xfcbingen, Deutschland'</code>, that's a <code>str</code> object encoded in latin1 or cp1252 or whatever. You'll need to decode that to a <code>unicode</code> object then encode that in UTF-8 then percent-escape it.</p> <p>However if you have (VERY subtle difference) <code>u'Wilhelmstra\xdfe 123, T\xfcbingen, Deutschland'</code>, that's a <code>unicode</code> object and you'll need to encode that in UTF-8 then percent-escape it.</p> <p>You said """ i still get the same error message: Exception Type: UnicodeEncodeError Exception Value: 'ascii' codec can't encode character u'\xdf' in position 10: ordinal not in range(128) when requesting the link """</p> <p>This looks like you are feeding a <code>unicode</code> object to something which wants a <code>str</code> object and tries to get it by encoding using the (usual default) <code>ascii</code> encoding. If you continue to have this problem, show your code. Break it down to the minimum necessary (as I did above). Show repr(step_by_step_results).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload