> For the complete documentation index, see [llms.txt](https://clu.gitbook.io/python-web-crawler-note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clu.gitbook.io/python-web-crawler-note/guan-yu-bian-ma.md).

# 6. 不同編碼/文件類型的爬蟲

有時候我們爬的網頁可能不是使用UTF-8編碼的, 這時候就需要在程式裡面處理編碼的問題.

那要怎麼看目標網頁的編碼呢? 其實只要透過developer tool觀看網頁的head部分即可, 在head區塊裡, 找到meta標籤, 其中的charset就是該網頁的編碼了, 譬如說以下就是用UTF-8編碼的網頁:

```
<meta charset="UTF-8">
```

若你要爬的網頁, 其編碼不是UTF-8, 就必須在程式裡面處理了, 接下來的範例會示範怎麼做這件事.

至於不同的文件類型, 除了html外, 也許你有一天也會碰上xml, 那這時候就可以選用可處理xml的library去處理其內容.
