Repository: denoland/deno (language: rust)

Issue:
CLI completions output for PowerShell mangled on Windows
Version: deno 2.0.2 (stable, release, x86_64-pc-windows-msvc)

Shell: PowerShell (pwsh) 7.4.6
Terminal: Windows Terminal Preview 1.23.10353.0

I'm initialising deno completions in PowerShell profile using the example from documentation:
```PowerShell
if (Get-Command -Name "deno" -ErrorAction SilentlyContinue) {
    deno completions powershell | Out-String | Invoke-Expression
}
```

Which results in PowerShell error when starting new terminal instance:
```pwsh

Invoke-Expression: C:\Users\andis\Documents\PowerShell\Completions\deno.ps1:2
Line |
   2 |      deno completions powershell | Out-String | Invoke-Expression
     |                                                 ~~~~~~~~~~~~~~~~~
     | Missing ')' in method call.
```


I looked at the output using redirection to a file `deno completions powershell | Out-File deno-completions.tmp.ps1` and noticed a strange string of 6 characters on line 114 of the output: `ŌÜĀ’ĖÅ`.
```pwsh
[CompletionResult]::new('bundle', 'bundle', [CompletionResultType]::ParameterValue, 'ŌÜĀ’ĖÅ `deno bundle` was removed in Deno 2.  See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations')
```

Compare the the output from `deno completions powershell` without involving PowerShell by running the command in cmd shell and redirecting output to a file:
```pwsh
[CompletionResult]::new('bundle', 'bundle', [CompletionResultType]::ParameterValue, '⚠️ `deno bundle` was removed in Deno 2.  See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations')
```



It seems that PowerShell redirection is mangling the UTF-8 character (⚠️) even though it shouldn't because terminal is using UTF-8 and all involved files are UTF-8 encoded.

Just to make sure it's not my environment or some Windows charset translation shenanigans I tried to execute the unmangled script as written by `deno completions powershell > deno-comletions.tmp2.ps1` and it works as expected.


## Possible workaround
Set charset to UTF-8 explicitly in PowerShell profile file before loading completions:
```pwsh
$OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
```


Discussion / hints:

Fix patch:
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index e00af3a83e5a5e..6cf8d684ef65ed 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -1772,7 +1772,7 @@ If you specify a directory instead of a file, the path is expanded to all contai
 }
 
 fn bundle_subcommand() -> Command {
-  command("bundle",  "⚠️ `deno bundle` was removed in Deno 2.
+  command("bundle",  "`deno bundle` was removed in Deno 2.
 
 See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations", UnstableArgsConfig::ResolutionOnly)
     .hide(true)
@@ -3321,7 +3321,7 @@ different location, use the <c>--output</> flag:
 
 fn vendor_subcommand() -> Command {
   command("vendor",
-      "⚠️ `deno vendor` was removed in Deno 2.
+      "`deno vendor` was removed in Deno 2.
 
 See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations",
       UnstableArgsConfig::ResolutionOnly


Test patch:
diff --git a/tests/specs/bundle/removed/bundle_help.out b/tests/specs/bundle/removed/bundle_help.out
index 349043baaf43d2..e1f43dfea61891 100644
--- a/tests/specs/bundle/removed/bundle_help.out
+++ b/tests/specs/bundle/removed/bundle_help.out
@@ -1,4 +1,4 @@
-⚠️ `deno bundle` was removed in Deno 2.
+`deno bundle` was removed in Deno 2.
 
 See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
 
diff --git a/tests/specs/vendor/removed/vendor_help.out b/tests/specs/vendor/removed/vendor_help.out
index aeda5176ff0fb9..98aca359d76ced 100644
--- a/tests/specs/vendor/removed/vendor_help.out
+++ b/tests/specs/vendor/removed/vendor_help.out
@@ -1,4 +1,4 @@
-⚠️ `deno vendor` was removed in Deno 2.
+`deno vendor` was removed in Deno 2.
 
 See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations