rakelkar / gonetsh

GO wrapper for the windows NETSH tool
Apache License 2.0
11 stars 10 forks source link

not support windows system with chinese language #12

Open barnettZQG opened 4 years ago

barnettZQG commented 4 years ago

not support windows system with chinese language.

PS C:\k> netsh interface ipv4 show addresses

接口 "vEthernet (以太网)" 的配置
    DHCP 已启用:                          是
    IP 地址:                           172.24.203.207
    子网前缀:                        172.24.192.0/20 (掩码 255.255.240.0)
    默认网关:                         172.24.207.253
    网关跃点数:                       0
    InterfaceMetric:                      15

接口 "Loopback Pseudo-Interface 1" 的配置
    DHCP 已启用:                          否
    IP 地址:                           127.0.0.1
    子网前缀:                        127.0.0.0/8 (掩码 255.0.0.0)
    InterfaceMetric:                      75

接口 "vEthernet (nat)" 的配置
    DHCP 已启用:                          否
    IP 地址:                           172.26.16.1
    子网前缀:                        172.26.16.0/20 (掩码 255.255.240.0)
    InterfaceMetric:                      5000
wayne-cheng commented 2 weeks ago

Not only with Chinese language, but this problem also occurs with other non-English languages. I think running chcp 65001 before executing netsh would be a easy way to fix this. I'd like to submit a PR to fix the issue @rakelkar .

Additionally, the project Calico also depends on this gonetsh. The change will be very useful for adapting it to Windows Server systems in various languages.