Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit cfdc6c7

Browse files
edyoungalerickson
authored andcommitted
Fix bug #9, use utf8 for .nuspec
1 parent 8c6ed52 commit cfdc6c7

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

Tests/PSGetPublishScript.Tests.ps1

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,45 @@ function SuiteCleanup {
8686
RemoveItem $script:TempScriptsPath
8787
}
8888

89+
Describe PowerShell.PSGet.PublishNonEnglishCharacterScriptTests -Tags 'BVT' {
90+
BeforeAll {
91+
SuiteSetup
92+
}
93+
94+
AfterAll {
95+
SuiteCleanup
96+
}
97+
98+
BeforeEach {
99+
100+
}
101+
102+
AfterEach {
103+
RemoveItem "$script:PSGalleryRepoPath\*"
104+
RemoveItem $script:PublishScriptFilePath
105+
RemoveItem "$script:TempScriptsPath\*.ps1"
106+
RemoveItem "$script:TempScriptsLiteralPath\*"
107+
108+
}
109+
110+
It "PublishScriptRoundTripsNonAnsiCharacters" {
111+
$description = "Remplace toutes les occurrences d'un modèle de caractère"
112+
New-ScriptFileInfo -Path $script:PublishScriptFilePath `
113+
-Version $script:PublishScriptVersion `
114+
-Author Author@contoso.com `
115+
-Description $description `
116+
-Force
117+
118+
$sfi = Test-ScriptFileInfo -Path $script:PublishScriptFilePath
119+
AssertEquals $description $sfi.Description
120+
121+
Publish-Script -Path $script:PublishScriptFilePath -NuGetApiKey $script:ApiKey
122+
$psgetItemInfo = Find-Script $script:PublishScriptName
123+
124+
AssertEquals $description $psgetItemInfo.description
125+
}
126+
127+
}
89128
Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {
90129
BeforeAll {
91130
SuiteSetup
@@ -123,6 +162,7 @@ Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {
123162

124163

125164

165+
126166
# Purpose: Validate Publish-Script cmdlet with versioned script dependencies
127167
#
128168
# Action:
@@ -1142,7 +1182,7 @@ Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {
11421182

11431183
# Purpose: Validate that Publish-Module prompts to upgrade NuGet.exe if local NuGet.exe file is less than minimum required version
11441184
#
1145-
# Action: Publish-Script
1185+
# Action: Publish-Script
11461186
#
11471187
# Expected Result: Publish operation should fail, NuGet.exe should not upgrade to latest version
11481188
#
@@ -2128,4 +2168,4 @@ Describe PowerShell.PSGet.PublishScriptTests.P2 -Tags 'P2','OuterLoop' {
21282168
AssertEquals $res2.Name $ScriptName "Find-Script didn't find the exact script which has dependencies, $res2"
21292169
Assert ($res2.Dependencies.Name.Count -ge ($DepencyModuleNames.Count+$RequiredScripts.Count+1)) "Find-Script with -IncludeDependencies returned wrong results, $res4"
21302170
}
2131-
}
2171+
}

src/PowerShellGet/private/functions/Publish-PSArtifactUtility.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ $CsprojContent = @"
471471
Microsoft.PowerShell.Management\Remove-Item $NuspecPath -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Confirm:$false -WhatIf:$false
472472
}
473473

474-
Microsoft.PowerShell.Management\Set-Content -Value $nuspec -Path $NuspecPath -Force -Confirm:$false -WhatIf:$false
474+
Microsoft.PowerShell.Management\Set-Content -Value $nuspec -Path $NuspecPath -Force -Confirm:$false -WhatIf:$false -Encoding UTF8
475475

476476
# Create .nupkg file
477477
if($script:DotnetCommandPath) {
@@ -553,7 +553,7 @@ $CsprojContent = @"
553553

554554
if(Test-Path -Path $tempErrorFile -PathType Leaf) {
555555
$errorMsg = Microsoft.PowerShell.Management\Get-Content -Path $tempErrorFile -Raw
556-
556+
557557
if($errorMsg) {
558558
Write-Verbose -Message $errorMsg
559559
}

0 commit comments

Comments
 (0)