Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chinese characters sometimes display wrong #877

Closed
CKylinMC opened this issue Jun 23, 2020 · 6 comments
Closed

Chinese characters sometimes display wrong #877

CKylinMC opened this issue Jun 23, 2020 · 6 comments

Comments

@CKylinMC
Copy link

Hi, I was confused by one thing when I learning MySQL using mycli.
I made a query, and got a wrong result, the characters display in a wrong coding:
mysql1

But when I maximized the window and redo the query, it runs correctly:
mysql2

I tried the official tool and it's correct whatever I maximized the window or not:
mysql3

I dumped a SQL file: mysqdumps.sql

Don't mind the content and sorry for my poor English.

@gfrlv
Copy link
Member

gfrlv commented Jul 23, 2020

Do you have wcwidth installed (check with pip freeze | grep wcwidth)?
Seems like an issue with tabulate -- a library we use to render tables.

@CKylinMC
Copy link
Author

Do you have wcwidth installed (check with pip freeze | grep wcwidth)?
Seems like an issue with tabulate -- a library we use to render tables.

image
I think it has been installed automatically.

@ZDSDESIRE
Copy link

ZDSDESIRE commented Jul 29, 2020

It works on my Windows 10:

  1. Enter “chcp” in CMD or Windows PowerShell to view the current character encoding:
    QQ截图20200729163419

936: GBK
65001: UTF-8
437: OEM USA

  1. Try to do that:
    QQ截图20200729163132

  2. Try again enter "chcp" in cmd:
    QQ截图20200729163205
    Finish.

@CKylinMC
Copy link
Author

@ZDSDESIRE I followed your steps and I found that CMD's "active code page" is still "936", the problem is still here.
But when I switch to use Windows Terminal, it's worked, and its "active code page" is 65001.
Thanks.

@ZDSDESIRE
Copy link

@CKylinMC
You can enter "chcp 65001" to change the current CMD window's "active code page" , but this only applies to the current window.
If you want to change the default state, you need to run the "regedit.exe".
Find the path: "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor".
Add or modify the option "Autorun" whose value is "chcp 65001".

@CKylinMC
Copy link
Author

It works. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants