zoukankan      html  css  js  c++  java
  • Windows下 phpstorm terminal 中文乱码解决办法

    解决办法有多个,比如使用wsl,git的bash,而我要介绍的是使用原始的cmd解决utf-8编码的问题,一般情况下我们在terminal 下执行php文件,如果里面有中文就会显示乱码,像下面这样

    Options:
      -n, --no-interaction  Do not ask any interactive question
      -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
    
    Available commands:
      auto_off                         姣忓垎閽熸�娴嬩竴娆″渾缁囨満涓嬫満鏁版嵁
      automatic_deduction              姣忓ぉ8:50妫€娴嬩竴娆℃墍鏈夊叕鍙哥殑濂楅�璧勮垂鎯呭喌骞舵墸璐
    

    这是因为cmd默认使用的编码是gbk(代码936)

    F:>chcp
    活动代码页: 936
    

    解决思路就是把这里的编码改为utf-8(65001)即可,之后在运行脚本就是正常的显示了

    F:>chcp 65001
    Active code page: 65001
    ...
    Options:
      -n, --no-interaction  Do not ask any interactive question
      -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
    
    Available commands:
      auto_off                         每分钟检测一次***
      automatic_deduction              每天8:50检测一次***
    

    那么在terminal如何处理呢?
    打开 File->Settings->Tools->Terminal,将Application settings下的Shell path设为 cmd.exe /k chcp 65001 & cls
    以后就不用管文字编码的问题,愉快地coding吧

  • 相关阅读:
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    HAService 刨坑
    RocketMQ服务器监控误区
    Send [1] times, still failed
    RECONSUME_LATER
    RocketMQ 自定义文件路径
    RocketMQ 运维指令
    Thrift 学习记录
    服务网格(Service Mesh)学习记录
    Linux 安装 Apache
  • 原文地址:https://www.cnblogs.com/lantor/p/13753986.html
Copyright © 2011-2022 走看看