Hey guys,
I have a simple installation of one jenkins instance in version 2.504.1 and have some encoding issues when Im using powershell 7.
Jenkins is running on a Windows Server 2022 and Powershell 7.5.0 is currently installed.
My pipeline execution looks like:
node {
pwsh '''
Set-Location 'D:/jenkins-scripts'
if ($env:JEN_TESTMODE -eq $true) {
.\\powershell-script.ps1 `
-parameter1 "$env:JENKINS_PARAMETER1" `
-parameter2 "$env:JENKINS_PARAMETER2" `
-parameter3 "$env:JENKINS_PARAMETER3" `
-testmode `
} else {
.\\powershell-script.ps1 `
-parameter1 "$env:JENKINS_PARAMETER1" `
-parameter2 "$env:JENKINS_PARAMETER2" `
-parameter3 "$env:JENKINS_PARAMETER3" `
}
I was running the script with windows powershell before. The output was fine. Now I have to change to powershell 7 for several reasons and the output of special characters is broken.
I added two lines to validate the used encoding:
Write-Host "`$OutputEncoding: $($OutputEncoding.EncodingName)"
Write-Host "[Console]::OutputEncoding: $([Console]::OutputEncoding.EncodingName)"
And here is the result when im using “Write-Warning” in the powershell script:
So its looks to me, that UTF-8 is used and found several articles to this topic. I added a system wide environment variable to windows and rebooted the whole system.
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
Everything I found is not working. Does someone know a working solution?
I really appretiate your help.
thanks in advanced
Alex