# Chinese IME input inside string literals causes garbled pinyin characters to appear in SQL editor

**URL:** https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890
**Category:** v6
**Created:** [September 21, 2026, 2:31pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890 "2026-09-21T14:31:44Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sergeyteleshev](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/sergeyteleshev/32/5558_2.png) [@sergeyteleshev](https://discuss.codemirror.net/u/sergeyteleshev)
#### Post date: [September 21, 2026, 2:31pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/1 "2026-09-21T14:31:44Z")

</div>

**Description** When typing Chinese inside a single-quoted SQL string, intermediate pinyin text may remain after confirming the Chinese candidate. Existing text can also disappear or be replaced unexpectedly.

**Steps to reproduce**

1. Open an editor with SQL syntax highlighting enabled.
2. Type a single quote '.
3. Switch to a Chinese Pinyin IME.
4. Type `zcfzb` and select `资产负债表`.
5. Repeat if necessary—the issue is intermittent. Expected behavior Confirming the candidate replaces the intermediate pinyin with `资产负债表`, preserving the surrounding text. Actual behavior Intermediate characters remain alongside the Chinese text, for example: `'z'c'f'z'b资产负债表'` Sometimes surrounding text disappears or is replaced.

**Additional observations**

- Reported with `@codemirror/view 6.43.0`.
- Reproduces intermittently on Windows.
- Ordinary typing did not reproduce it on macOS, where the IME displayed spaces between letters rather than apostrophes.
- Not observed when SQL language support is disabled.

**Original issue**

> <https://github.com/dbeaver/cloudbeaver/issues/4489>
>
> \### Description
> 
> When this happens, a pop-up error will appear：  
> TypeError
> 
> \###… Steps to reproduce
> 
> 1、Open a SQL editor and connect to a database
> 2、Type a single quote ' to start a string literal
> 3、Switch to a Chinese IME (e.g. Pinyin)
> 4、Start typing Chinese characters inside the quotes
> 
> \### Expected/Desired Behavior
> 
> During composition, only the IME candidate text should appear at the cursor position. After confirming the composition, the final Chinese characters should be inserted into the string literal.
> 
> \### CloudBeaver Version
> 
> CloudBeaver 26.1.3
> 
> \### Additional context
> 
> During composition, raw pinyin intermediate characters (e.g. 'z'c'f'z'b) appear directly in the editor content alongside the IME composition UI. The result is garbled: 'z'c'f'z'b资产负债表'.
> Important:
> This does not happen when the SQL editor is disconnected from the database (no SQL language support loaded)

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [September 21, 2026, 2:32pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/2 "2026-09-21T14:32:52Z")

</div>

Which browser are you seeing this in?

---

<div class="post-metadata">

### Author: ![sergeyteleshev](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/sergeyteleshev/32/5558_2.png) [@sergeyteleshev](https://discuss.codemirror.net/u/sergeyteleshev)
#### Post date: [September 22, 2026, 1:20am UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/3 "2026-09-22T01:20:20Z")

</div>

Hi! We’ve been testing with Chrome

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [September 22, 2026, 6:14am UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/4 "2026-09-22T06:14:33Z")

</div>

I tried reproducing this (Chrome 153 Windows, Simplified Chinese Pinyin keyboard). I create an editor with just `[basicSetup(), sql()]` as extensions, and two single quotes as initial content. Then I put the cursor between the quotes and repeatedly type z-c-f-z-b-Space. But I’m getting only the Chinese text—the Latin characters disappear as they are supposed to. Am I doing something different from how you reproduce this?

---

<div class="post-metadata">

### Author: ![Snoppy007](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/snoppy007/32/5564_2.png) [@Snoppy007](https://discuss.codemirror.net/u/Snoppy007)
#### Post date: [October 6, 2026, 3:09pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/5 "2026-10-06T15:09:22Z")

</div>

like this: select ‘123123213131’,‘sdfsfsd’,t.\* from DIM\_AREA t where t.city=‘北京’;

If you want to replace ‘北京’ with ‘上海’, then the whole SQL will turn into a meaningless statement.

---

<div class="post-metadata">

### Author: ![Snoppy007](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/snoppy007/32/5564_2.png) [@Snoppy007](https://discuss.codemirror.net/u/Snoppy007)
#### Post date: [October 6, 2026, 3:09pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/6 "2026-10-06T15:09:27Z")

</div>

I was able to reproduce this in both Chrome and Edge.

---

<div class="post-metadata">

### Author: ![Snoppy007](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/snoppy007/32/5564_2.png) [@Snoppy007](https://discuss.codemirror.net/u/Snoppy007)
#### Post date: [October 6, 2026, 3:10pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/7 "2026-10-06T15:10:05Z")

</div>

You need to connect to a database first, like SQLite or some other database, and then open the SQL editor. If you type Chinese in the quotes, the characters will get replaced.

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [October 6, 2026, 3:11pm UTC](https://discuss.codemirror.net/t/chinese-ime-input-inside-string-literals-causes-garbled-pinyin-characters-to-appear-in-sql-editor/9890/8 "2026-10-06T15:11:12Z")

</div>

If the issue requires a database to reproduce, it is likely not a CodeMirror problem. If you can set up an editor in [codemirror.net/try](https://codemirror.net/try) that reproduces it, do let me know.
