mycli icon indicating copy to clipboard operation
mycli copied to clipboard

How I should set my Terminal setting on windows 10 to make it work well? (Chinese garbled)

Open Sunyelw opened this issue 6 years ago • 7 comments

on mysql: image

on mycli: Uploading image.png…

And locale is: Uploading image.png…

Any suggestions ? Could you help me? thx. @tsroten

Sunyelw avatar May 18 '19 10:05 Sunyelw

sunyelw@windows:$ locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8" LC_MESSAGES="zh_CN.UTF-8" LC_ALL=zh_CN.UTF-8
sunyelw@windows:$

mysql root@localhost:asia> select * from ac_currency_type limit 1; +----+------------------+--------------------+--------------------+----------------+-------+------------+------+----------+----------+--------------+----------+------------------+-----------------+---------------------+--------------+--------------+-----------+---------------------+---------------------+-------+ | id | currency_type_id | currency_type_name | currency_type_code | acct_type_code | scope | scope_type | unit | is_multi | is_defer | pre_pay_type | pay_type | condition_amount | discount_amount | max_discount_amount | acct_rule_id | product_line | meta_info | gmt_create | gmt_update | state | +----+------------------+--------------------+--------------------+----------------+-------+------------+------+----------+----------+--------------+----------+------------------+-----------------+---------------------+--------------+--------------+-----------+---------------------+---------------------+-------+ | 1 | 1201 | 璐︽埛浣欓 | BALANCE | BALANCE | | | | 0 | 0 | | | | | | | | | 2019-04-17 16:44:30 | 2019-04-17 16:44:30 | 1 | +----+------------------+--------------------+--------------------+----------------+-------+------------+------+----------+----------+--------------+----------+------------------+-----------------+---------------------+--------------+--------------+-----------+---------------------+---------------------+-------+ 1 row in set Time: 0.035s

Sunyelw avatar May 18 '19 10:05 Sunyelw

@Sunyelw Here are the settings that I'm using that allow me to see Chinese text as expected:

  1. Font setting: NSimSun
  2. ~Code page set to UTF-8: chcp 65001~
  3. Locale set to UTF-8:
    C:\Users\tsr>locale
    LANG=
    LC_CTYPE="C.UTF-8"
    LC_NUMERIC="C.UTF-8"
    LC_TIME="C.UTF-8"
    LC_COLLATE="C.UTF-8"
    LC_MONETARY="C.UTF-8"
    LC_MESSAGES="C.UTF-8"
    LC_ALL=
    
  4. Pager set to less: set PAGER=less

Sample screenshot: chinese-text

tsroten avatar May 18 '19 13:05 tsroten

@tsroten Very Thx for your help! But I don't know how to set the first step and second step...., I do three step and four step that it works bad again.

Sunyelw avatar May 19 '19 05:05 Sunyelw

@Sunyelw So, for #2, I would try to avoid that one (a lot of people warn against that on various sites like StackOverflow).

As far as #1 goes -- you need to make sure cmd.exe is using a font that supports the required characters. Here is a popular option (1st download link) - https://math.berkeley.edu/~serganov/ilyaz.org/software/fonts/

This answer on StackOverflow might help - https://stackoverflow.com/a/47843552

I do believe that using a capable font is key to making the output look as expected (in addition to the PAGER setting).

tsroten avatar May 20 '19 01:05 tsroten

Maybe you can try this: https://github.com/dbcli/mycli/issues/877#issuecomment-665533179 即“控制面板” -> "时钟和区域" -> “管理” -> 系统区域设置为中文之后,勾选“Beta版:使用 Unicode UTF-8 提供全球语言支持(U)”,重启电脑即可。

ZDSDESIRE avatar Jul 29 '20 09:07 ZDSDESIRE

兄弟,你怎么试出来的,这么牛逼

shenyangElpsy avatar Jan 12 '21 13:01 shenyangElpsy

@shenyangElpsy 我几乎忘了还有这个 issue, 我也忘了是怎么试出来的, 现在已经换Mac了.... 这个 issue 貌似可以关了~

Sunyelw avatar Jan 25 '21 01:01 Sunyelw