Python 使用selenium page_源代码编码问题

Python 使用selenium page_源代码编码问题,python,selenium,encoding,Python,Selenium,Encoding,我一直在尝试从苹果商店TOP1000获取数据。我一直在使用以下代码: from selenium import webdriver from bs4 import BeautifulSoup import json profile = webdriver.FirefoxProfile() #Create a profile that makes my browser act like I am browsing from an iPad. profile.set_preference("gen

我一直在尝试从苹果商店TOP1000获取数据。我一直在使用以下代码:

from selenium import webdriver
from bs4 import BeautifulSoup
import json

profile = webdriver.FirefoxProfile()
#Create a profile that makes my browser act like I am browsing from an iPad.
profile.set_preference("general.useragent.override", "iTunes-iPad/5.1.1 (64GB; dt:28)")
driver = webdriver.Firefox(profile)

driver.get('https://itunes.apple.com/WebObjects/MZStore.woa/wa/topChartFragmentData?cc=cn&genreId=6014&pageSize=5&popId=38&pageNumbers=0')

soup = BeautifulSoup((driver.page_source).encode('utf-16'))

dict_from_json = json.loads(soup.find("body").text)

print(dict_from_json)
出于某种原因,Firefox Webdriver以“西部”编码打开此页面(显示在“视图”下拉框中的“文本编码”下)

这使得一些外国商店(即中国/日本)都争先恐后地购买“½æ°”或“½æ游ääääääääääää”等商品。如果我将此编码更改为Unicode选项,则一切正常

我还没有找到一种方法说服Firefox通过Selenium打开这个unicode“视图”页面。此外,在我的脚本中,我强制将页面源代码编码为utf-8,但仍然给出了相同的奇怪字符

我现在有点不知所措,不知道我是如何以我想要的方式看到这些角色的

谢谢你能给我的任何帮助