回答編集履歴
2
些細
answer
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
>>> r = requests.get('https://search.rakuten.co.jp/search/keyword/')
|
5
5
|
|
6
|
-
>>> import chardet
|
7
|
-
|
8
6
|
>>> r.apparent_encoding
|
9
7
|
'Windows-1254'
|
10
8
|
|
9
|
+
>>> import chardet
|
10
|
+
|
11
11
|
>>> chardet.detect(r.content)
|
12
12
|
{'encoding': 'Windows-1254', 'confidence': 0.3693754690993527, 'language': 'Turkish'}
|
13
13
|
```
|
1
説明追記
answer
CHANGED
@@ -5,9 +5,17 @@
|
|
5
5
|
|
6
6
|
>>> import chardet
|
7
7
|
|
8
|
+
>>> r.apparent_encoding
|
9
|
+
'Windows-1254'
|
10
|
+
|
8
11
|
>>> chardet.detect(r.content)
|
9
12
|
{'encoding': 'Windows-1254', 'confidence': 0.3693754690993527, 'language': 'Turkish'}
|
13
|
+
```
|
14
|
+
トルコ語に認識されています。
|
10
15
|
|
16
|
+
|
17
|
+
EUCを明に指定してdeocdeしても失敗します。
|
18
|
+
```plain
|
11
19
|
>>> r.content.decode('euc_jp')
|
12
20
|
Traceback (most recent call last):
|
13
21
|
File "<stdin>", line 1, in <module>
|