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吧

  • 相关阅读:
    函数依赖(转)
    C++对象的深拷贝和浅拷贝
    C++临时匿名对象
    C++操作符重载
    C数组和指针
    动态开发入门之Servlet
    数据库的CURD操作 以及经典的sql语句
    如何删除07版word页眉页脚的横线
    数据库的连接查询
    经典面试题 详细解析Java中抽象类和接口的区别
  • 原文地址:https://www.cnblogs.com/lantor/p/13753986.html
Copyright © 2011-2022 走看看