Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

Fix UTF-8 parsing for Windows operation JSON params

kogekiplayfa6fe1a3f9b4
diff --git a/apps/OpenComputerUseWindows/runtime.ps1 b/apps/OpenComputerUseWindows/runtime.ps1
index 0ca3ba7..63ca1ed 100644
--- a/apps/OpenComputerUseWindows/runtime.ps1
+++ b/apps/OpenComputerUseWindows/runtime.ps1
@@ -852,7 +852,12 @@ function Invoke-TypeText($process, [string]$text) {
return $false
}
-$operation = Get-Content -Raw -Path $OperationPath | ConvertFrom-Json
+# Read the operation file as UTF-8 explicitly. Windows PowerShell 5.1's
+# Get-Content defaults to the system ANSI code page (e.g. GBK on Chinese
+# systems) for files without a BOM, which corrupts non-ASCII input such as
+# Chinese text passed to set_value/type_text.
+$operationJson = [System.IO.File]::ReadAllText($OperationPath, [System.Text.Encoding]::UTF8)
+$operation = $operationJson | ConvertFrom-Json
try {
if ($operation.tool -eq "list_apps") {