hermes - 💡(How to fix) Fix [Bug]: Chinese input gets truncated (last 1-2 characters are swallowed) in the input field

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When typing Chinese characters using an Input Method Editor (IME) in the input field, the last one or two characters are often "swallowed" (truncated/cut off).

This issue might be related to an incorrect text length calculation, such as treating multi-byte characters (like UTF-8 encoded Chinese characters) as single-byte characters, or a mismatch in handling IME composition events (compositionend/compositionupdate) when restrictions like maxLength are applied.

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Code Example

it seens work fine but eat last two chinese words ,maybe ui problem

---
RAW_BUFFERClick to expand / collapse

Bug Description

Description

When typing Chinese characters using an Input Method Editor (IME) in the input field, the last one or two characters are often "swallowed" (truncated/cut off).

This issue might be related to an incorrect text length calculation, such as treating multi-byte characters (like UTF-8 encoded Chinese characters) as single-byte characters, or a mismatch in handling IME composition events (compositionend/compositionupdate) when restrictions like maxLength are applied.

Environment (Optional but helpful)

  • OS: [e.g., Windows 11]
  • Hermes Desktop Version:
  • IME Used: [e.g., macOS Default Pinyin / Sogou Pinyin / Microsoft Pinyin]

Steps to Reproduce

Steps to Reproduce

  1. Open Hermes Desktop.
  2. Focus on the text input field.
  3. Switch to a Chinese Input Method Editor (IME) (e.g., Pinyin).
  4. Type a sentence or a sequence of Chinese characters.
  5. Confirm/commit the text.

Expected Behavior

Expected Behavior

The entire entered Chinese text should be fully displayed and preserved in the input field without any characters being cut off.

Actual Behavior

Possible Causes (for reference)

  • Character Length vs. Byte Length: The input field limit or length calculation might be counting bytes instead of characters. Since a Chinese character typically takes 3 bytes in UTF-8, this can easily trigger premature truncation.
  • IME Composition Handling: The application might be committing or truncating the text before the IME composition is fully finished.

Actual Behavior

The last 1 to 2 Chinese characters are missing or stripped from the input field after committing.

Affected Component

Other

Messaging Platform (if gateway-related)

No response

Debug Report

it seens work fine but eat last two chinese words ,maybe ui problem

Operating System

Windows 11

Python Version

3.11.4

Hermes Version

0.15.1

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING