Giter Site home page Giter Site logo

Windows 中文显示问题 about chsrc HOT 13 CLOSED

lixxu avatar lixxu commented on August 25, 2024
Windows 中文显示问题

from chsrc.

Comments (13)

lixxu avatar lixxu commented on August 25, 2024 2

ok, 我尝试把python.bat, python3.bat, python3.11.bat, pip.bat都改成了utf-8, 仍然不起作用. 我去pyenv那边看看, 谢谢解惑.
图片

from chsrc.

lixxu avatar lixxu commented on August 25, 2024 1

把pyenv.bat里的编码改成utf-8就可以了, issue可以关了.
图片
图片

from chsrc.

lixxu avatar lixxu commented on August 25, 2024 1

我看到pyenv-win里的issue有人在讨论chcp这个问题才去试一下, 应该和这个issue有关.
https://github.com/pyenv-win/pyenv-win/issues/344

from chsrc.

ccmywish avatar ccmywish commented on August 25, 2024

你好,@lixxu

还没遇到过这种情况。上图中是第二次运行时有问题。所以,是每次打开终端后,第二次运行chsrc才有问题吗?

from chsrc.

lixxu avatar lixxu commented on August 25, 2024

不是, 运行chsrc get py时每次都有问题, 其它的貌似没问题.
图片

from chsrc.

ccmywish avatar ccmywish commented on August 25, 2024

我这边配置跟你一样的,也是 windows11 + powershell + starship

image

应该是你的 python3 的输出导致 chsrc 乱码了。你看下你的 python3 命令的

  1. 版本
  2. 如何安装的
  3. 以及默认输出编码(可能是其他编码方式,如GBK之类的)

可能把第三点调成 UTF-8 就没问题了

from chsrc.

lixxu avatar lixxu commented on August 25, 2024

用pyenv安装的, 默认编码好像已经是utf8了.
图片

from chsrc.

ccmywish avatar ccmywish commented on August 25, 2024

你的 python3 确认是和 python 相同吗?

from chsrc.

lixxu avatar lixxu commented on August 25, 2024

图片

from chsrc.

ccmywish avatar ccmywish commented on August 25, 2024
  1. 你用 Get-Command pythonGet-Command python3 分别看下

  2. 我恰巧开发了 rbenv-for-Windows,所以我怀疑 pyenv 是导致问题的原因。 pyenv 如果我没记错,是按着 rbenv 实现的。所以你看下 pyenv 管理下的 python3 命令是 .bat 还是 .exe ? 我怀疑可能是 pyenv 的存在导致第一层编码是 GBK,然后才是你Python3的编码UTF-8

from chsrc.

lixxu avatar lixxu commented on August 25, 2024

是的, 确实是.bat导致的.
图片
图片

from chsrc.

ccmywish avatar ccmywish commented on August 25, 2024

不知道 pyenv 为啥要设置为 1250. rbenv-for-windows 的实现就完全没有这个问题。

image

可以联系 pyenv-win 的开发者询问一下原因,以及解决方法。因为它这么设置以后,chsrc 肯定就乱码了,我这边无能为力。

这个 issue 暂时保持开启

from chsrc.

ccmywish avatar ccmywish commented on August 25, 2024

恭喜终于解决了 💯

pyenv.bat 里咋还有一个 chcp 呢,哈哈。若以后你知道为什么,可以在这里留言,我也学习了解一下。

from chsrc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.