Chinese character incorrectly parsed when using Gemini models

Hi, thanks for reporting an issue with Cursor.

Before you report this, we’d appreciate if you can search this forum to see if this issue has already been reported.

If you have done so, please check this box.
on

Describe the Bug

When using Chinese, the Gemini series models are garbled in the Cursor.

Steps to Reproduce

Open Cursor’s Chat and enter: “使用中文回答。用 FastAPI 写一个 Hello World”. You will see a lot of garbled characters.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 0.44

Additional Information

This problem will occur when using Chinese programming

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

2 Likes

The problem only occurs with Gemini series models

1 Like

The same to me. Just for Gemini series models.

In my experience, I’ve encountered the same issue with claude-3-5-sonnet-20241022 as well. It’s not that all Chinese characters are corrupted—only a small portion of them. However, it’s exactly those few that often lead to inexplicable bugs. It would be great if this could be addressed as well.

2 Likes

The Claude series models do occasionally display garbled Chinese characters, but it does not affect the overall use. The Gemini series has garbled characters in every answer and is completely unusable.

1 Like

The current occurrence of invalid characters is still the case, you can try to use this tool to manually detect it.

Thank you, but what I need now is that the Chinese reply content of Gemini in Cursor’s CHAT page is not garbled, not the content in the code file.

I’ve used it in my case and haven’t encountered any garbled code. Try upgrading to the latest version?

Version: 0.44.8
VSCode Version: 1.93.1
Commit: f3b5a63019e4e2283033b4db987a35f8413c7570
Date: 2024-12-22T05:48:08.427Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0

Mac may encounter this situation

I also have 0.44.8, but on macOS, Chinese characters are still garbled.

Can you try adding this paragraph to .cursorrules or Cursor Setting → General → Rules for AI?

Output: Please do not include the Unicode Character (U+FFFD) in the response text.

Thank you! I have now given up on using Gemini provided by Cursor, and instead directly input Gemini’s official API Key into Cursor. There will be no garbled Chinese characters when filling in the official API Key.

OK!

No wonder I’ve been having no problems on my end. I am using the
Gemini’s official api token, which is set in the Cursor.

However, after manually entering the Gemini API, the Chat page does not support uploading pictures, and the Cursor is still not perfect.

Related GitHub Issues: When using Chinese, the Gemini series models are garbled in the Cursor · Issue #2511 · getcursor/cursor · GitHub

Related Issues:

Not working.

It’s not just the Gemini model, I’ve often encountered the problem of occasional Chinese characters turning into the unknown symbol ‘�’, as in the example below, which ai keeps trying to fix, but it’s not working.


I think this is a problem with the ‘Apply’ of the code (the second model) rather than the model itself.

1 Like

I can confim! it is correct!

The problem is NOT the AI model, is the cursor built in encoder! After the generation, cursor will compare and match and replace the corresponding text in your file, during that process, the garbled text “��” will randomly occurs across all of your files!!

This is devasting for indie devlopers since it is like minefield, can happen very randomly, you can prevent this no matter how good your prompting skills are!!

1 Like

it not relate to Gemini, Sometimes,Claude has the same issue.

There is no problem with Claude. The problem is the ‘apply’ of Cursor, which has a small probability of generating Chinese garbled characters. However, the problem with Gemini is that 100% of the replies on the Chat page will generate Chinese garbled characters, and Gemini is unusable.