Merge pull request #4425 from microsoft/mikebattista/#4423
Update /_utils/Set-All-Text-File-Template-Encodings.ps1 to support PowerShell Core
This commit is contained in:
Коммит
ae61901436
|
@ -8,6 +8,14 @@
|
|||
# Any files that don't have the desired encoding will be changed
|
||||
# so they are encoded as desired.
|
||||
|
||||
if ($PSVersionTable.PSEdition -eq "Desktop") {
|
||||
Write-Host "The latest version of PowerShell is required to run this script. Windows PowerShell is not supported."
|
||||
Write-Host ""
|
||||
Write-Host "Install the latest stable release of PowerShell from https://aka.ms/powershell-release?tag=stable."
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function Is-EncodedCorrectly
|
||||
{
|
||||
[OutputType([Boolean])]
|
||||
|
@ -17,7 +25,7 @@ function Is-EncodedCorrectly
|
|||
[string]$Path
|
||||
)
|
||||
|
||||
[byte[]]$byte = get-content -Encoding byte -ReadCount 3 -TotalCount 3 -Path $Path
|
||||
[byte[]]$byte = Get-Content -AsByteStream -Raw -Path $Path
|
||||
|
||||
# EF BB BF (UTF8 + BOM)
|
||||
if ( $byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf )
|
||||
|
|
Загрузка…
Ссылка в новой задаче