1
0
mirror of synced 2025-12-21 10:57:10 -05:00

update wording (#25226)

This commit is contained in:
Sarah Edwards
2022-02-10 12:10:20 -08:00
committed by GitHub
parent 564733534e
commit 67b43ec86b

View File

@@ -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:
@@ -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 %}