From 67447bc7f1aee7b16281b264c2851e23f62bc7cd Mon Sep 17 00:00:00 2001 From: Engelgardt23 Date: Sun, 17 May 2026 18:10:09 +0300 Subject: [PATCH] fix(v1.0.2): suppress netsh output to avoid mojibake on RU console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit netsh emits in the OEM code page (CP866 on RU Windows); the modern console showed it as 'DHCP ╤Г╨╢╨╡ ╨▓╨║╨╗╤О╤З╨╡╨╜╨╛...'. Our own English Setting/Done lines remain, and Get-NetIPAddress already prints proper Unicode. --- CHANGELOG.md | 4 ++++ src/netswitch.ps1 | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b00315..293ef22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and ## [Unreleased] +## [1.0.2] - 2026-05-17 +### Fixed +- Suppress `netsh` output to avoid mojibake on non-UTF-8 consoles (Russian Windows printed `╤Г╨╢╨╡ ╨▓╨║╨╗╤О╤З╨╡╨╜╨╛...` because netsh emits in the OEM code page). Our own English status lines remain; the post-change `Get-NetIPAddress` block already prints Unicode. + ## [1.0.1] - 2026-05-17 ### Changed - Dropped the `made by engelgardt` line from the startup banner — keep author credit in the README only. diff --git a/src/netswitch.ps1 b/src/netswitch.ps1 index 5486ab6..7c71a74 100644 --- a/src/netswitch.ps1 +++ b/src/netswitch.ps1 @@ -1,7 +1,7 @@ # netswitch v1.0.0 - quick NIC IP / DHCP toggle # made by engelgardt -$NetswitchVersion = '1.0.1' +$NetswitchVersion = '1.0.2' $GithubRepo = 'Engelgardt23/netswitch' $ErrorActionPreference = 'Stop' @@ -107,8 +107,8 @@ if ($modeChoice.Trim() -eq '2') { # --- DHCP --- Write-Host "" Write-Host "Setting $($nic.Name) to DHCP..." -ForegroundColor Yellow - & netsh interface ipv4 set address name="$($nic.Name)" source=dhcp - & netsh interface ipv4 set dnsservers name="$($nic.Name)" source=dhcp + $null = & netsh interface ipv4 set address name="$($nic.Name)" source=dhcp 2>&1 + $null = & netsh interface ipv4 set dnsservers name="$($nic.Name)" source=dhcp 2>&1 Write-Host "Done." -ForegroundColor Green } else { @@ -125,9 +125,9 @@ else { Write-Host "Setting $($nic.Name) -> $ip / $mask$( if ($gw) { " via $gw" })" -ForegroundColor Yellow if ([string]::IsNullOrWhiteSpace($gw)) { - & netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask + $null = & netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask 2>&1 } else { - & netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask $gw + $null = & netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask $gw 2>&1 } Write-Host "Done." -ForegroundColor Green }