MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    Solved linux 终端中中文乱码怎么解决?

    使用交流
    mirai-console 编码
    4
    12
    541
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Wybxc
      Wybxc last edited by Wybxc

      问题已解决。
      使用 dpkg-reconfigure locales 重新配置语言包后,显示正常。

      6018b25d-2433-43e3-a208-e2c20d2f61f4-image.png

      如图,上面 mirai-console 的输出是乱码,下面用 python 输出的中文正常。

      windows 下使用 ssh 连接远程 linux 服务器,使用的终端是 ConEmu。服务器系统 Debian 10.2。

      1 Reply Last reply Reply Quote 0
      • C
        CAB233 last edited by

        安装中文字体试试,估计也是编码之类的问题
        sudo apt-get install fonts-wqy-zenhei

        Wybxc 1 Reply Last reply Reply Quote 0
        • Wybxc
          Wybxc @CAB233 last edited by

          @cab233 不行。

          我用的是远程终端,估计和字体没有关系;而且下面用 python 可以正常显示输出的中文。

          1 Reply Last reply Reply Quote 0
          • C
            CAB233 last edited by

            可以用cmd试试,看有没有问题

            Wybxc 1 Reply Last reply Reply Quote 0
            • Wybxc
              Wybxc @CAB233 last edited by

              @cab233 这是服务器上的linux系统,不是windows

              C 1 Reply Last reply Reply Quote 0
              • C
                CAB233 @Wybxc last edited by

                @wybxc 我的意思是在cmd中进行ssh连接
                f8efd493-1c69-4469-aa3d-4aedc095307a-image.png

                Wybxc 1 Reply Last reply Reply Quote 0
                • Wybxc
                  Wybxc @CAB233 last edited by

                  @cab233 9fe72c6c-26b5-416f-b39a-46a8fad8850d-image.png
                  91b5fc94-bd5a-4c63-a42c-075f64d431fa-image.png

                  mirai 的输出还是有问题。

                  1 Reply Last reply Reply Quote 0
                  • Karlatemp
                    Karlatemp last edited by

                    如果别的程序能正常输出中文,这一般都是 java 运行时版本过低或者 java 运行时出现错误,尝试更新你的java运行时

                    Wybxc 1 Reply Last reply Reply Quote 0
                    • Karlatemp
                      Karlatemp last edited by

                      另外检查一下终端编码是否为 UTF8

                      1 Reply Last reply Reply Quote 0
                      • Wybxc
                        Wybxc @Karlatemp last edited by

                        @karlatemp 更新到 OpenJDK JRE16 依然有问题。

                        控制台编码如下,都是 UTF-8:

                        LANG=zh_CN.UTF-8
                        LANGUAGE=
                        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_PAPER="zh_CN.UTF-8"
                        LC_NAME="zh_CN.UTF-8"
                        LC_ADDRESS="zh_CN.UTF-8"
                        LC_TELEPHONE="zh_CN.UTF-8"
                        LC_MEASUREMENT="zh_CN.UTF-8"
                        LC_IDENTIFICATION="zh_CN.UTF-8"
                        

                        似乎只有 mirai 不能显示中文。像 mcl-installer(使用 rust 编写)都可以正常显示中文。

                        1 Reply Last reply Reply Quote 0
                        • Wybxc
                          Wybxc last edited by

                          问题已解决。
                          使用 dpkg-reconfigure locales 重新配置语言包后,显示正常。

                          1 Reply Last reply Reply Quote 1
                          • Y
                            yurenchen000 last edited by

                            和楼主遇到相同问题。
                            估计是 服务端 locale 不对, 服务端 console 把不认识的字符统一转义成 ? 字符了。

                            典型的是 tree 命令表格字符是 ascii 或 ?
                            我用 export LC_ALL=C.UTF-8 解决的

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact