Skip to content

RTL language support (Persian/Arabic) - characters appear reversed and disconnected #16875

Closed as not planned

Description

@ajomik

Description

Hello,

I'm using OpenCode on Windows with WezTerm terminal and Persian (Farsi)
text is not displayed correctly. The characters appear reversed and
disconnected (not joined properly).

RTL languages like Persian and Arabic require proper Bidi (bidirectional)
text rendering support in the TUI.

Please add RTL/Bidi text support so Persian and Arabic users can use
OpenCode properly.

Thank you!

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

WezTerm

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Mar 10, 2026
  2. github-actions commented on Mar 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review these issues and consider commenting on an existing one if it covers your use case.

  3. removed
    bugSomething isn't working
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  4. hbx12 commented on May 30, 2026

    @hbx12

    I'd like to investigate this issue and work on a fix.

    I'm currently helping with Arabic/RTL improvements and would like to start by reproducing the problem and documenting affected areas before proposing changes.

  5. razavioo commented on Jul 29, 2026

    @razavioo

    Community plugin available: opencode-rtl

    For those looking for RTL support, we've built an OpenCode plugin that automatically applies Unicode bidi isolation (RLI/LRI/PDI) to the AI's responses and system prompts.

    npm install opencode-rtl
    // opencode.json
    {
      "plugin": [
        ["opencode-rtl", { "language": "auto" }]
      ]
    }

    What it fixes today:

    • Injects RTL system prompts so the AI responds in your language
    • Protects inline code (console.log()) and markdown blocks from getting scrambled by wrapping them in LTR isolates
    • Works out-of-the-box for Arabic, Persian, Hebrew, Urdu, etc.
    • Fixes character ordering and mixed-direction (BiDi) text issues

    Current limitations:

    • Right-alignment: The plugin fixes the ordering of words and code (which fixes a lot of the unreadable output), but the text is still left-aligned. Full right-alignment requires native support in the renderer (like CSS dir="rtl" as discussed in this issue, or native alignment in the CLI TUI).
    • Streaming: It formats the text after the response completes. (We are proposing a streaming hook to fix this).

    Repo: https://github.com/razavioo/opencode-rtl

  6. razavioo commented on Sep 27, 2026

    @razavioo

    The reversed/disconnected characters issue happens because the terminal doesn't know which segments are RTL. The opencode-rtl plugin fixes this by wrapping RTL segments with Unicode bidi isolation characters.

    Install:

    npm install opencode-rtl
    

    Configure (opencode.json):

    {
      "plugin": [["opencode-rtl", { "language": "fa" }]]
    }

    Or for OpenCode 2:

    {
      "plugins": [{ "package": "opencode-rtl", "options": { "language": "fa" } }]
    }

    Important: your terminal must support Unicode bidi rendering. Recommended terminals: WezTerm, iTerm2, Windows Terminal, or Ghostty.

  7. marked Arabic Character Bug #47982 as a duplicate of this issue on Oct 20, 2026
  8. opencodejr commented on Oct 29, 2026

    @opencodejr

    Thanks for the report and the screenshot!

    This was filed before OpenCode 2 was released, so it's about OpenCode v1 (versions 0.x/1.x). v1 now only gets fixes for critical bugs, so RTL/bidi rendering is unlikely to be added there.

    We'd encourage you to upgrade to v2 (@opencode/cli, the opencode command). The v2 desktop/web app has RTL support (#40372). The v2 terminal UI doesn't handle bidirectional text yet, though, so in the terminal Persian/Arabic may still look wrong.

    In the meantime, the community plugin opencode-rtl mentioned above may help. It adds bidi isolation marks to responses, which fixes much of the character ordering but not the alignment.

    Related issues:

    If you think this is critical, or you see the same problem on v2, please reply here with your opencode --version output.

  9. opencodejr commented on Oct 30, 2026

    @opencodejr

    Closing this as not planned. The report is about OpenCode v1, which only gets critical fixes, and we didn't hear back about whether it also happens on v2.

    The v2 terminal UI doesn't render RTL text properly yet either. If you see this on v2, please open a new issue with your opencode --version output. You can also try the community plugin opencode-rtl, which fixes much of the character ordering. Thanks again for reporting it!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions