Skip to content

PowerShell Chinese encoding + docx read + grep download + Word COM issues on Windows #27476

Closed

Description

Description

On Windows 11, OpenCode encountered several toolchain issues when asked to process .docx files (read and write) and handle non-ASCII text through PowerShell:

1. Read tool: cannot handle .docx files

Read returns Cannot read binary file for .docx (ZIP+XML). This is a very common format for documents.

2. Grep tool: transport error downloading ripgrep

Transport error (GET https://github.com/BurntSushi/ripgrep/releases/download/...)

Prevents file content search when ripgrep is not yet installed.

3. PowerShell $var: syntax causes ParserError

When writing PowerShell scripts, patterns like "[$file:$lineNum] $line" trigger:

Variable reference is not valid. ':' was not followed by a valid variable name character.

Generated code snippets should use ${file} to be safe.

4. PowerShell console garbles non-ASCII characters

Chinese characters output via Write-Host appear as mojibake, requiring workarounds (write to file, then Read).

5. Word COM (New-Object -ComObject Word.Application) fails when Word is absent

Throws Unexpected HRESULT on systems without Microsoft Word installed. No fallback available.

6. Read tool truncates single-line files at 2000 chars

Files without line breaks (e.g., extracted docx text) appear as one line truncated to 2000 characters.

Steps to reproduce

  1. Read a .docx file → Cannot read binary file
  2. grep on Windows without preinstalled ripgrep → Transport error
  3. Write-Host "[$file:$lineNum] $line" in PowerShell → ParserError
  4. New-Object -ComObject Word.Application without Word → HRESULT

Operating System

Windows 11

Terminal

PowerShell 7 (pwsh.exe)

OpenCode version

1.14.50

Activity

  1. github-actions commented on May 14, 2026

    @github-actions
    Contributor

    This issue appears to be a duplicate of an existing issue. Please check:

    Please continue the discussion on #27475 and close this one to avoid fragmentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions