From 00e3f88980d1e8fa88fa6c1121ad24e01b2e4a7e Mon Sep 17 00:00:00 2001 From: Jens Reinemann Date: Sun, 17 May 2026 22:33:45 +0200 Subject: [PATCH] fix(tests): UTF-8 in Invoke-Api korrekt escapen fuer PS5.1 Kompatibilitaet PS5.1 kodiert String-Bodies in Invoke-RestMethod mit der Windows-Systemkodierung (Windows-1252) statt UTF-8. Fix: Non-ASCII-Zeichen werden vor dem Senden als \uXXXX escaped, sodass der HTTP-Body reines ASCII ist und korrekt interpretiert wird. Schliesst die UTF-8-Testfaelle (Szenario 6a) vollstaendig ab: 35/35 PASS. --- run-integration-tests.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/run-integration-tests.ps1 b/run-integration-tests.ps1 index 2aa44e7..16ff276 100644 --- a/run-integration-tests.ps1 +++ b/run-integration-tests.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Bollwerk Integration Test Suite .DESCRIPTION @@ -60,6 +60,16 @@ function Invoke-Api { $headers = @{ "Content-Type" = "application/json" } if ($Token) { $headers["Authorization"] = "Bearer $Token" } $bodyJson = if ($Body) { $Body | ConvertTo-Json -Depth 10 -Compress } else { $null } + # PS5.1 sendet String-Body mit Windows-Systemkodierung statt UTF-8. + # Alle Non-ASCII-Zeichen als \uXXXX escapen → Body ist ASCII-sicher. + if ($bodyJson) { + $sb = [System.Text.StringBuilder]::new($bodyJson.Length * 2) + foreach ($ch in $bodyJson.ToCharArray()) { + if ([int]$ch -gt 127) { [void]$sb.Append('\u{0:x4}' -f [int]$ch) } + else { [void]$sb.Append($ch) } + } + $bodyJson = $sb.ToString() + } try { $response = Invoke-RestMethod -Method $Method ` -Uri "$BaseUrl$Path" `