-1
나는 내 db에서 일부 문자열을 추출하기 위해 docker에 포장 된 python3.5 asyncio + aiomysql을 사용하고 있습니다. 나는 'ваш-шиномонтаж.рф'을 얻을 것으로 기대하지만 ??? - ??????????. ?? 대신.예상 한대로 문자가 없습니다 (??? - ?????????? ?? 대신)
# encoding: utf-8
import asyncio
from aiomysql import create_pool
async def get_pool(loop):
return await create_pool(host='127.0.0.1', port=3306, user='dbu', password='pwd', db='db', loop=loop)
async def get_sites(pool):
async with pool.acquire() as conn:
async with conn.cursor() as cur:
await cur.execute(
"select canonic_domain from site where id=1132",
())
sites = await cur.fetchall()
for s in sites:
print(type(s[0]))
print(s[0])
return sites
def process():
loop = asyncio.get_event_loop()
pool = loop.run_until_complete(loop.create_task(get_pool(loop)))
sites = loop.run_until_complete(loop.create_task(get_sites(pool)))
if __name__ == "__main__":
process()
출력 : 연결로 PARAMS 추가하여 해결
<class 'str'>
???-??????????.??
I expect:
<class 'str'>
'ваш-шиномонтаж.рф'
what could be the problem?
대답은 php에 주어졌지만 아무런 차이가 없으며, 같은 제안은 파이썬에서도 마찬가지입니다. http://stackoverflow.com/questions/279170/utf-8-all-the-way-through – zerkms