作者pig98520 (Jimmy)
看板Python
標題[問題]中文字串 ascii編碼問題
時間Mon Mar 4 17:35:06 2019
大家好,最近爬蟲時遇到一個問題,
爬蟲爬下來的字串為str1,存到SQL後的字串為str2,
但當我select下來比對後,發現兩者字串不相符,
比對ascii code後發現這樣的問題:
https://imgur.com/FkZmLGh
想問一下為何會發生這樣的問題?有解決的方法嗎..QAQ
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.133.44.129
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1551692111.A.C79.html
推 shala: CJK Compatibility Ideographs。解決方法我想只能自己轉換 03/04 17:41
推 Raymond0710: unicodedata.normalize('NFKD', '\uf90a' )=='\u91d1 03/05 00:53
→ pig98520: 感謝兩位大大,已經順利解決了~ 03/05 10:59