[BUG] Tables with CJK characters are misaligned in terminal output
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When Claude Code generates tables containing CJK (Chinese, Japanese, Korean) characters, the columns are misaligned in terminal output. Claude does not account for the display width of CJK characters (2 terminal columns) versus ASCII characters (1 column).
Example request:
Create a reference table for the following mobile app error codes. Include columns for: error code, Japanese message, English message, and the screen where it appears.
- E001: ログインに失敗しました / Login failed / LoginScreen
- E002: ネットワーク接続エラー / Network connection error / anywhere
- E003: セッションがタイムアウトしました / Session timed out / all authenticated screens
- E004: データの読み込みに失敗しました / Failed to load data / HomeScreen, SettingsScreen
- E005: アプリバージョンが古いです。アップデートしてください / App version outdated. Please update. / LaunchScreen
- E006: 無効なユーザーIDまたはパスワード / Invalid user ID or password / LoginScreen
- E007: サーバーメンテナンス中 / Server maintenance in progress / all screens
Claude produces:
| Error Code | Japanese Message | English Message | Screen |
|------------|----------------------------|--------------------------------------|----------------------------|
| E001 | ログインに失敗しました | Login failed | LoginScreen |
| E002 | ネットワーク接続エラー | Network connection error | anywhere |
| E003 | セッションがタイムアウトしました | Session timed out | all authenticated screens |
| E004 | データの読み込みに失敗しました | Failed to load data | HomeScreen, SettingsScreen |
| E005 | アプリバージョンが古いです。アップデートしてください | App version outdated. Please update. | LaunchScreen |
| E006 | 無効なユーザーIDまたはパスワード | Invalid user ID or password | LoginScreen |
| E007 | サーバーメンテナンス中 | Server maintenance in progress | all screens |
The column separators (|) do not align vertically.
What Should Happen?
Claude should calculate display width correctly:
- CJK characters = 2 terminal columns each
- ASCII characters = 1 terminal column each
Then pad cells to ensure consistent display width per column, producing aligned output.
Error Messages/Logs
(no error - just visual misalignment)
Steps to Reproduce
- Ask Claude Code to create a markdown table with Japanese/Chinese/Korean text in one column and English in another, or mixed ASCII / CJK characters within one or more columns. See example above.
- Observe that the | column separators do not align vertically
<img width="1498" height="524" alt="Image" src="https://github.com/user-attachments/assets/92a19839-f0a9-4841-9c70-8a3433bca2a2" />
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
i don't recall this being broken before, but it may have always been this way; i just noticed it this week ...
Claude Code Version
Claude Code v2.0.61
Platform
Google Vertex AI
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Although this can (unreliably) be worked around by adding (many lines of) new instructions to CLAUDE.md, or possibly by creating an external tool for CJK formatting and trying to get the tool to use it in this context, this is something that users shouldn't have to waste time customizing ...
(the below generated by claude)
Severity: This required approximately 10 correction attempts during a single conversation before Claude produced a correctly aligned table. The user had to explain
display width concepts and debug the padding character by character.
Root causes identified:
- Claude treats all characters as 1 column wide
- When attempting to add padding, Claude miscounts or uses inconsistent padding characters
- Claude does not distinguish between ASCII spaces (1 col) and full-width spaces (2 cols)
Proposed solution: Add to Claude Code's system instructions or model behavior:
- When generating tables with CJK content, calculate display width (2 for wide chars, 1 for narrow)
- Use full-width spaces (U+3000) for padding CJK columns
- Ensure separator row dash count equals target display width
- Output tables in fenced code blocks to preserve spacing
Reference: Unicode Standard Annex #11 (East Asian Width) defines character width properties.
5 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
the first issue has been closed, so i can't comment on it. the second issue appears to be a replacement of the first.
however, it is specifically discussing the web interface, and i am using claude code in a terminal.
I confirm this is the case when generating ASCII tables with box-drawing characters (│, ─, ├, └, etc.), Claude miscalculates padding because it counts UTF-8 bytes instead of display width. This causes closing border characters to be misaligned with the rest of the table.
I suspect the rune size versus byte size issue is the same with a lot of multibytes unicode characters...
This has been fixed. The markdown table renderer now uses display width instead of character count, so CJK characters (2 columns wide) are properly accounted for in column alignment.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.