Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions eng/Localize/RemoveUtf8Bom.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Removes UTF-8 BOM from localized files produced by the XLoc tool.
# Used via the xLocCustomPowerShellScript input in the OneLocBuild task.
# The XLocFileList environment variable is set by the task and contains
# the path to a text file listing all localized files to process.

function RemoveUtf8Bom
{
param(
[string]$FilePath
)

$encoding = New-Object -TypeName System.Text.UTF8Encoding -ArgumentList $false
$content = Get-Content -Path $FilePath -Encoding UTF8
[System.IO.File]::WriteAllText($FilePath, $content -join "`n", $encoding)
}

foreach ($locFile in (Get-Content -Path $env:XLocFileList))
{
RemoveUtf8Bom -FilePath $locFile
}
1 change: 1 addition & 0 deletions eng/pipelines/templates/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ stages:
MirrorRepo: 'NuGet.Client'
MirrorBranch: ${{ replace(variables['Build.SourceBranch'], 'refs/heads/', '') }}
GitHubOrg: 'NuGet'
xLocCustomPowerShellScript: 'eng/Localize/RemoveUtf8Bom.ps1'

- stage: Build_Insertable
displayName: Build NuGet inserted into VS and .NET SDK
Expand Down