Skip to content

Markdown table columns misaligned with CJK characters on Telegram and Discord #55512

Description

@zjy282

Description

Markdown tables containing CJK (Chinese/Japanese/Korean) characters are rendered with misaligned columns on both Telegram and Discord channels.

Problem

  • Telegram: Tables are wrapped in <pre> blocks, but column padding uses String.length instead of display width. CJK characters occupy 2 terminal columns but are counted as 1, causing all subsequent columns to shift left.
  • Discord: Markdown tables are sent as-is with raw pipe (|) syntax. Discord does not support GFM tables natively, so the table renders as plain broken text.

Example

A table like:

|          | Framework A              | Framework B         |
|----------|--------------------------|---------------------|
| 类型      | 前端渲染框架                | 后端服务框架           |
| 语言      | TypeScript               | Go                  |
| 部署方式   | 静态托管                   | 容器化部署             |

Renders misaligned on Telegram because "类型" (2 chars, 4 display columns) is padded as if it were 2 display columns.

On Discord, the table is not rendered at all — raw pipes and dashes are shown.

Expected Behavior

  1. Telegram: Use East Asian Width-aware string width calculation (e.g., string-width npm package or equivalent) when padding table cells in <pre> blocks.
  2. Discord: Convert markdown tables to code blocks with proper monospace alignment (also CJK-aware), since Discord does not support GFM table rendering.

Environment

  • OpenClaw version: 2026.3.24
  • Channels: Telegram, Discord
  • Language: Chinese (zh-CN)

Screenshots

Telegram table rendering with misaligned CJK columns:

The columns after CJK text are shifted left because each CJK character is only counted as width 1 instead of width 2.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions