Skip to content

Commit

Permalink
update wording (github#25226)
Browse files Browse the repository at this point in the history
  • Loading branch information
skedwards88 authored Feb 10, 2022
1 parent 5647335 commit 67b43ec
Showing 1 changed file with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ During the execution of a workflow, the runner generates temporary files that ca

{% warning %}

**Warning:** On Windows, legacy PowerShell (`shell: powershell`) does not use UTF-8 by default. Make sure you write files using the correct encoding. For example, you need to set UTF-8 encoding when you set the path:
**Warning:** On Windows, legacy PowerShell (`shell: powershell`) does not use UTF-8 by default.

When using `shell: powershell`, you must specify UTF-8 encoding. For example:

```yaml
jobs:
Expand All @@ -324,21 +326,7 @@ jobs:
run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
```
Or switch to PowerShell Core, which defaults to UTF-8:
```yaml
jobs:
modern-pwsh-example:
uses: windows-2019
steps:
- shell: pwsh
run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Append # no need for -Encoding utf8
```
More detail about UTF-8 and PowerShell Core found on this great [Stack Overflow answer](https://stackoverflow.com/a/40098904/162694):
> ### Optional reading: The cross-platform perspective: PowerShell _Core_:
> [PowerShell is now cross-platform](https://blogs.msdn.microsoft.com/powershell/2016/08/18/powershell-on-linux-and-open-source-2/), via its **[PowerShell _Core_](https://github.com/PowerShell/PowerShell)** edition, whose encoding - sensibly - **defaults to *BOM-less UTF-8***, in line with Unix-like platforms.
Alternatively, you can use PowerShell Core (`shell: pwsh`), which defaults to UTF-8.

{% endwarning %}

Expand Down

0 comments on commit 67b43ec

Please sign in to comment.