質問編集履歴
1
ソースコードを修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,51 +10,23 @@
|
|
10
10
|
|
11
11
|
よろしくお願いします。
|
12
12
|
|
13
|
+
|
14
|
+
|
15
|
+
コード:
|
16
|
+
|
17
|
+
```python
|
18
|
+
|
19
|
+
import urllib.request
|
20
|
+
|
21
|
+
html = urllib.request.urlopen('https://~~~~~ñ~~~').read().decode('Latin-1')
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
|
13
27
|
エラー内容:
|
14
28
|
|
15
|
-
```
|
29
|
+
```error
|
16
|
-
|
17
|
-
Traceback (most recent call last):
|
18
|
-
|
19
|
-
File "exbs.py", line 81, in <module>
|
20
|
-
|
21
|
-
html = urllib.request.urlopen(search_url.decode("utf-8")).read()
|
22
|
-
|
23
|
-
File "/usr/local/python/lib/python3.4/urllib/request.py", line 161, in urlopen
|
24
|
-
|
25
|
-
return opener.open(url, data, timeout)
|
26
|
-
|
27
|
-
File "/usr/local/python/lib/python3.4/urllib/request.py", line 463, in open
|
28
|
-
|
29
|
-
response = self._open(req, data)
|
30
|
-
|
31
|
-
File "/usr/local/python/lib/python3.4/urllib/request.py", line 481, in _open
|
32
|
-
|
33
|
-
'_open', req)
|
34
|
-
|
35
|
-
File "/usr/local/python/lib/python3.4/urllib/request.py", line 441, in _call_chain
|
36
|
-
|
37
|
-
result = func(*args)
|
38
|
-
|
39
|
-
File "/usr/local/python/lib/python3.4/urllib/request.py", line 1225, in https_open
|
40
|
-
|
41
|
-
context=self._context, check_hostname=self._check_hostname)
|
42
|
-
|
43
|
-
File "/usr/local/python/lib/python3.4/urllib/request.py", line 1182, in do_open
|
44
|
-
|
45
|
-
h.request(req.get_method(), req.selector, req.data, headers)
|
46
|
-
|
47
|
-
File "/usr/local/python/lib/python3.4/http/client.py", line 1088, in request
|
48
|
-
|
49
|
-
self._send_request(method, url, body, headers)
|
50
|
-
|
51
|
-
File "/usr/local/python/lib/python3.4/http/client.py", line 1116, in _send_request
|
52
|
-
|
53
|
-
self.putrequest(method, url, **skips)
|
54
|
-
|
55
|
-
File "/usr/local/python/lib/python3.4/http/client.py", line 973, in putrequest
|
56
|
-
|
57
|
-
self._output(request.encode('ascii'))
|
58
30
|
|
59
31
|
UnicodeEncodeError: 'ascii' codec can't encode character '\xf1' in position 56: ordinal not in range(128)
|
60
32
|
|