googleapis / googleapis/python-genai
Gemini 2.5 models fail to process Japanese (CJK) input via REST API — garbled text and broken Google Search Grounding queries
- Dominant language
- Python
- Stars
- 4k
- Forks
- 1k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 40
Description
This is a product issue affecting all Gemini 2.5 models via the REST API directly (not specific to this Python client library). Filing here as the closest public issue tracker for the Gemini API.
## Summary
All Gemini 2.5 models (Pro, Flash, Flash-Lite) fail to correctly process Japanese text input sent via the REST API. The models interpret valid UTF-8 Japanese characters as garbled/corrupted text. Gemini 3.x models handle the exact same request correctly.
#### Environment details
- Programming language: N/A (tested with raw `curl` REST calls)
- OS: Windows 11 Pro
- Language runtime version: N/A
- Package version: N/A (REST API `v1beta` endpoint)
- Affected models: `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`, `gemini-2.5-flash-lite-preview-09-2025`
- Working model: `gemini-3.1-flash-lite-preview`
#### Steps to reproduce
**1. Send Japanese text to Gemini 2.5 Pro and ask it to repeat back:**
```bash
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "次のテキストをそのままオウム返ししてください: 2026年3月11日の日本の最新ニュースを教えて"}]}]}'
Expected: Model repeats the Japanese text back correctly.
Actual: Model responds with "文字化けしているようですね" ("It seems like the text is garbled"), confirming it cannot read the input.
2. Send Japanese text to Gemini 2.5 Flash-Lite with Google Search Grounding:
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "2026年3月11日の日本の最新ニュースを教えて"}]}], "tools": [{"google_search": {}}]}'
Expected: Model generates Japanese search queries and returns relevant results.
Actual: webSearchQueries is empty [], model responds "It looks like your request is incomplete or contains unusual characters".
3. Same request to Gemini 3.1 Flash-Lite (control — works correctly):
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-lite-preview:generateContent?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "2026年3月11日の日本の最新ニュースを教えて"}]}], "tools": [{"google_search": {}}]}'
Result: Correctly generates webSearchQueries: ["What happened on March 11 2026", "2026年3月11日 ニュース"] and returns relevant Japanese news.
4. English input on Gemini 2.5 Flash-Lite (works correctly):
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "What are the latest news in Japan on March 11, 2026?"}]}], "tools": [{"google_search": {}}]}'
Result: Works correctly — webSearchQueries: ["Japan news March 11 2026", "latest news Japan March 2026"].
Summary Table
Model | Japanese Input | Search Grounding (JP) | English Input
-- | -- | -- | --
gemini-2.5-pro | ❌ Garbled | ❌ Broken | ✅ Works
gemini-2.5-flash | ❌ Garbled | ❌ Broken | ✅ Works
gemini-2.5-flash-lite | ❌ Garbled | ❌ Broken | ✅ Works
gemini-3.1-flash-lite-preview | ✅ Works | ✅ Works | ✅ Works
Impact
- Japanese users cannot use any Gemini 2.5 model via REST API for Japanese text
- Google Search Grounding is completely unusable with Japanese queries on 2.5 models
- This likely affects other CJK languages as well (Chinese, Korean — not tested)
- Workaround: Use Gemini 3.x models, but these incur a per-query Search Grounding charge that 2.5 models do not have
Contributor guide
Assessment
This issue has not been assessed yet.