Skip to content

Persian/Arabic (RTL) text is not displayed correctly in opencode TUI #32984

Closed as duplicate

Description

@eskbusiness

OpenCode version: 1.17.8
Operating System: Ubuntu 24.04.4 LTS, kernel 6.8.0-111-generic, x86_64
Terminal: GNU Screen 4.09.01, TERM=xterm-256color

I work on a Persian RAG system and sometimes type or display Persian text in opencode. The text comes out garbled. Characters appear in the wrong order and letters are disconnected instead of forming proper ligatures. Mixed Persian and English text is unreadable. This makes opencode unusable for any conversation involving Persian or Arabic.

Steps to reproduce:

  1. opencode
  2. Type Persian text like سلام دنیا in the input field
  3. Characters appear disconnected or in the wrong visual order

I saw existing issues #16875 and #26915 about RTL support. My report is specifically about Persian text used in a RAG workflow: typing Persian in the input field and displaying Persian responses from the AI, both of which are broken in the TUI.

Activity

  1. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Jun 19, 2026
  2. github-actions commented on Jun 19, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now includes all the required information — version, OS, terminal, clear reproduction steps, and a concise description. The report looks good.

  3. nkhayatei commented on Jun 24, 2026

    @nkhayatei

    i have same problem with type Farsi or Arabic

    Image
  4. 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 in the TUI/CLI

    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 TUI renderer.
    • 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

  5. razavioo commented on Sep 27, 2026

    @razavioo

    This can be addressed today using the opencode-rtl plugin. It isolates Persian/Arabic text with Unicode bidi characters so terminals render them correctly.

    For OpenCode 2:

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

    For OpenCode 1:

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

    It also injects system guidance so the model structures its RTL responses properly (code blocks stay LTR, prose is isolated with bidi markers).

  6. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #16875, which tracks Persian/Arabic (RTL) text rendering in the TUI. Please add your terminal details there.

    In the meantime, the community opencode-rtl plugin mentioned there may help.

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