◉GEMINI LABJP
●CLI — Gemini CLI's stable release is v0.62.0 (Sep 29). The nightly has reached v0.64.0 (Oct 3, prerelease)●10/22 — 17 days left until the three veo-3.1 preview models shut down. The successor is gemini-omni-1.1-flash●AUTH — A report (#29101) of Gemini CLI auth failing for enterprise Workspace accounts has 55 comments. People want a way to isolate the cause●NEW — Estimating a Sheets-Driven Gemini Bill Across the Year-End Price Switch with Apps Script●TTS — gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts are generally available (Sep 22), along with a Voices endpoint●12/31 — 87 days left until the introductory pricing ends. 3.8 / 3.7 / 3.6 Flash move to $1.50 input and $7.50 output, from $0.75 and $3.75●CLI — Gemini CLI's stable release is v0.62.0 (Sep 29). The nightly has reached v0.64.0 (Oct 3, prerelease)●10/22 — 17 days left until the three veo-3.1 preview models shut down. The successor is gemini-omni-1.1-flash●AUTH — A report (#29101) of Gemini CLI auth failing for enterprise Workspace accounts has 55 comments. People want a way to isolate the cause●NEW — Estimating a Sheets-Driven Gemini Bill Across the Year-End Price Switch with Apps Script●TTS — gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts are generally available (Sep 22), along with a Voices endpoint●12/31 — 87 days left until the introductory pricing ends. 3.8 / 3.7 / 3.6 Flash move to $1.50 input and $7.50 output, from $0.75 and $3.75
Articles/Dev Tools
⟐ Dev Tools/2026-08-21Intermediate

Why My Length Limit Only Failed on the English Notifications, and the Width-Based Fit That Replaced It

I had Gemini write push notifications in Japanese and English, and only the English ones came out truncated on real devices. The culprit was measuring length in characters. Here are the measured widths and the post-generation fitting code that fixed it.

gemini115gemini-api284structured-output28i18npush-notificationtext-truncation

✦ Premium Article

A reader in the US wrote in during the third week of the rollout: the notification text stops mid-sentence.

The app is a wallpaper app I run on my own. It sends a short announcement whenever new pieces are added, in Japanese and English. Gemini writes the copy, and my prompt said, plainly, "keep it under 40 characters." The Japanese notifications had been landing perfectly every time, so I assumed the same instruction was doing its job for English.

Every device I had checked on was set to a Japanese locale. That is why I never saw it.

The problem was not the quality of Gemini's output. It was my choice of unit. Below is what I measured on the way to understanding that, and the implementation I ended up with.

The short version: I stopped asking the model to respect a length

Here is the shape of the current pipeline.

  1. Gemini is never told to be brief. Instead it returns two fields — lead and detail — as structured output.
  2. All length adjustment happens afterward, in deterministic code.
  3. The unit is display width, not character count, and the way width is counted changes per language.

The whole change is a move from "make the model obey" to "have the model return something that degrades gracefully, and do the trimming myself." Here is why.

The same sentence is more than twice as long in English

I started by measuring strings close to what I was actually shipping. Display width here means: every character whose East Asian Width property is W, F, or A counts as 2, everything else counts as 1.

LanguageCharactersDisplay widthText
ja3467新しい浮世絵の壁紙を8枚追加しました。歌川広重の東海道シリーズです。
en81818 new ukiyo-e wallpapers are now available, including Hiroshige's Tokaido series.
ja2549今週の追加分は葛飾北斎の富嶽三十六景から6枚です。
en7474This week we added 6 pieces from Hokusai's Thirty-six Views of Mount Fuji.

The same message: 34 characters in Japanese, 81 in English. A factor of 2.4.

Now apply a flat "under 40 characters" to both. Japanese gets to use 80 units of display width. English gets 40. The same number was acting as a limit twice as tight in one language as the other. The English copy was not losing information because the model ignored me. It was losing information because my instruction was unreasonable in English.

There is a second reason not to push this onto the model at all. Gemini works in tokens, and "40 characters" is not a quantity it can count accurately while generating. Writing maxLength into your response_schema does not change this either — the API does not enforce string length, so an over-long value can come back and validate fine. The moment you depend on the model for a length guarantee, your pipeline has an unbounded failure mode.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Be able to tell, in your own code, whether a character-count limit or a token limit is the thing quietly failing on your multilingual strings
✦Understand why the same sentence measures 67 in Japanese and 81 in English, and budget display width per language instead of guessing
✦Catch the class of bug where one locale ships truncated text for weeks before anyone reports it, using a check that runs before delivery
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⟐ Dev Tools2026-08-10
Finding the questions your help docs never answer, by asking Gemini to write the quiz
When support keeps asking something your help page already covers, generate questions from that page and check whether the page alone can answer them. A two-pass audit pipeline with call design and cost math.
⟐ Dev Tools2026-08-15
Before Adding New iPhone Widths, I Had Gemini Write Out the Branches I Already Had
Adding three new screen widths to four apps turned into an extraction job, not a rewrite. Here is why I let Gemini pull the branch table out of the source and kept every pass/fail decision in deterministic code.
◈ API / SDK2026-08-22
Once You Pass Twenty Mediation Groups, How Do You Find the Setting That Went Missing?
As ad mediation groups multiply, missing sources and type drift accumulate quietly. Here is the split I settled on: normalize the settings into one matrix, let code confirm the gaps, and send Gemini only the cells that need judgment.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links