Encoding 在python3.6中使用aiohttp时出现UnicodeEncodeError

Encoding 在python3.6中使用aiohttp时出现UnicodeEncodeError,encoding,python-asyncio,python-unicode,unicode-string,aiohttp,Encoding,Python Asyncio,Python Unicode,Unicode String,Aiohttp,我使用aiohttp向我的url发出请求,但我不知道为什么会发生此错误 async def get_location_data(url): try: async with aiohttp.ClientSession() as session: async with session.get(url) as response: data = await response.json() r

我使用aiohttp向我的url发出请求,但我不知道为什么会发生此错误

async def get_location_data(url):
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(url) as response:
                data = await response.json() 
                return data 
    except Exception:
        return None
当我得到响应并希望更改列表中的项目时,会发生以下错误:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-4: ordinal not in range(128)
我已经搜索了很多关于它的信息,有人说我应该使用response.text(encoding=“utf-8)或response.json(encoding=“utf-8)


如何修复此错误?

正如其他人所说,使用
await response.json(encoding=“utf-8”)
正如其他人所说,使用
await response.json(encoding=“utf-8”)

堆栈跟踪将可用堆栈跟踪将可用我重试,发现由于我们公司服务器中的某些配置无法从json响应中获取unicode字符串。感谢lotI再次尝试,我发现由于我们公司服务器中的某些配置,无法从json响应中获取unicode字符串。谢谢