python 3.x - PyMySQL and Pandas return garbled columns for Japanese characters -


i trying read tables database. when database contains numbers , english characters, data ok other tables in database contain japanese characters. when download these tables, columns japanese characters displays question marks: ???????????

my code:

import pymysql sshtunnel import sshtunnelforwarder    sshtunnelforwarder(         (ssh_host, ssh_port),         ssh_username=ssh_user,         ssh_pkey=mypkey,         remote_bind_address=(sql_ip, sql_port)) tunnel:         conn = pymysql.connect(host='127.0.0.1', user=sql_username,                 passwd=sql_password,                  port=tunnel.local_bind_port,db=db,unicode_results=true)          #data = pd.read_sql_query(query, conn)         data = pd.read_sql_query(query_2, conn,) 

i have tried pd.set_option('display.unicode.east_asian_width', true) worked me doesn't seem helpful here.

i solved problem , interested below answer: needed add charset='ujis' code.now not garbled.

conn = pymysql.connect(host='127.0.0.1', user=sql_username,                 passwd=sql_password,                  port=tunnel.local_bind_port,db=db,charset='uji') 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -