I have a weird thing going on in my powershell-script using svn commands. Following is an Powershell-Example Script:
$svnOutput = svn status Write-Host "Output when saved in a variable" $svnOutput Write-Host "Direct Output" svn status
If I run this script (within the powershell-console), I get two different outputs, if one of the files have non-ascii-characters in the name (in my examples umlauts like üöä). This is the output
Output when saved in a variable ? Test_äöü.txt Direct Output ? Test_���.txt
I am working on a Windows Server 2022 with a VisualSVNServer Version 5.4.1. I already tested following ideas:
chcp 65001 $svnOutput = svn status $svnOutput $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $svnOutput = svn status $svnOutput $svnOutput = & svn status | Out-String -Stream $svnOutput svn status > svn_status.txt $svnOutput = Get-Content -Path "svn_status.txt" -Encoding UTF8 $svnOutput $svnOutput = & svn status | Out-String -Stream $svnOutput
But all of them give the same error.
PS: this also happends with other commands like
$svnOutput = svn add . --force $svnOutput
which results in:
A Test_���.txt
Using svn add . --force
in the normal powershell, or even i a script works without any issues. Hopefully someone can help me here - thanks!