Skip to content

Commit

Permalink
Fix: Use UTF8 encoding for PowerShell console (#1925)
Browse files Browse the repository at this point in the history
* Fix: Use UTF8 encoding for PowerShell console

* Docs: Add #1925
  • Loading branch information
BornToBeRoot authored Feb 16, 2023
1 parent fc26a93 commit 7d2e018
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Source/NETworkManager.Models/AWS/AWSSessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
{
public static partial class AWSSessionManager
{
private static string _encodingCommand = "[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding";
private static string _setLocationCommand = "Set-Location -Path ~";
private static string _clearHostCommand = "Clear-Host";

public static string BuildCommandLine(AWSSessionManagerSessionInfo sessionInfo)
{
var commandLine = $"-NoExit -NoLogo -NoProfile -Command \"Set-Location -Path ~; Clear-Host; aws ssm start-session --target {sessionInfo.InstanceID}";
var commandLine = $"-NoExit -NoLogo -NoProfile -Command \"{_encodingCommand}; {_setLocationCommand}; {_clearHostCommand}; aws ssm start-session --target {sessionInfo.InstanceID}";

// Add profile
if (!string.IsNullOrEmpty(sessionInfo.Profile))
Expand Down
3 changes: 2 additions & 1 deletion docs/Changelog/next-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ New Feature
- [IP Scanner](https://borntoberoot.net/NETworkManager/Documentation/Application/IPScanner){:target="\_blank"}

## Bugfixes

AWS Session Manager
- Use UTF-8 encoding for embedded PowerShell console window [#1832](https://github.com/BornToBeRoot/NETworkManager/pull/1832){:target="\_blank"}

## Other
- Language files updated [#transifex](https://github.com/BornToBeRoot/NETworkManager/pulls?q=author%3Aapp%2Ftransifex-integration){:target="\_blank"}
Expand Down

0 comments on commit 7d2e018

Please sign in to comment.