Lesstep
Japanese input · U+3000 · Checked October 30, 2026

Full-width spaces that get past your checks

Japanese has its own space, U+3000 (the ideographic space), as wide as a kanji. In Mozc, the open-source version of Google Japanese Input, Space types it by default in hiragana mode when there is nothing to convert. So a name comes in as 山田 太郎, and a name of only   looks empty. JavaScript's trim() removes it. Many server-side checks don't:

CheckA lone U+3000
JavaScript trim()removed
Python strip()removed
Java strip()removed
Java trim()kept
Ruby stripkept
PHP trim()kept
SQL trim()kept

We ran the JavaScript (Node.js 24), Python 3.12, Java 21 and SQL (SQLite 3.45) rows. Ruby and PHP aren't installed here, so those rows are from their manuals: Ruby counts only NUL, tab, line feed, vertical tab, form feed, carriage return and the ASCII space as whitespace in a String, and PHP's trim() strips six ASCII characters unless you pass your own. PostgreSQL 18's manual also trims “a space by default”.

Checking on the server

A display name of only   passes name.strip.empty? in Ruby and trim($name) === '' in PHP. Strip Unicode spaces instead:

# Ruby: [[:space:]] is Unicode
name.gsub(
  /\A[[:space:]]+|[[:space:]]+\z/, "")

// PHP: the u flag makes \s Unicode
preg_replace("/^\s+|\s+$/u", "",
  $name);
mb_trim($name);  // PHP 8.4 and later

// Java 11 and later
name.strip();
name.isBlank();

Ruby's manual gives \s as the ASCII spaces only and [[:space:]] as any Unicode space. Rails' presence validation uses blank?, which matches [[:space:]], so it already catches a lone U+3000. PHP's source turns on Unicode classes for \s when a pattern has the u flag, and PHP 8.4 added mb_trim(), whose default list includes U+3000. We didn't run Ruby or PHP. In Java 21, trim() kept U+3000, strip() removed it and isBlank() returned true. In SQL, name the spaces yourself: SQLite's trim(name, '  ') removed both kinds.

Splitting and matching

Split 山田 太郎 on " " and you get one name, not two; a search for 東京 ラーメン (“Tokyo ramen”) looks for one word. Split on any space, and put the query and what you match it against through the same function:

const key = (text) => text
  .normalize("NFKC")
  .replace(/\s+/g, " ")
  .trim()
  .toLowerCase();

const words = key(query)
  .split(" ")
  .filter(Boolean);

NFKC turns U+3000 into an ordinary space, and full-width ABC into ABC. In JavaScript, \s also includes U+3000. key(" 東京 ラーメン ") gave 東京 ラーメン, two words. Java's \s doesn't include it unless the pattern starts with (?U): without it, 山田 太郎 stayed one piece. Python's split() with no argument splits on it. Show the text as the user typed it, and use the normalized copy only to compare.

Allow-lists and ranges

The space also gets in through character checks. In JavaScript, \s in an allow-list lets U+3000 through. A “Japanese characters” range that starts at U+3000 takes in the space itself and the marks 、。, so a label of one   passed it. Use script properties such as \p{sc=Han}, \p{sc=Hiragana} and \p{sc=Katakana} with the u flag: none of them matched U+3000. The long-vowel mark ー isn't in any of the three, so add it yourself.

What went wrong in real apps

The rest of a Japanese check

A name that looks empty in a list, or a search that finds nothing, can come down to one wide space. The same pass catches Enter while typing Japanese (the fix), yen charged 100 times over (the fix), kanji drawn in their Chinese shapes (the fix), headings that break in the middle of a word (the fix), postal codes rejected when typed in Japanese (the fix), dates saved one day early in Japan (the fix), address forms in the American order (the fix), phone numbers sent to +81 with the 0 still in (the fix), PDFs with the Japanese missing (the fix), search that finds nothing in Japanese (the fix), previews cut down to “...” in Japanese (the fix), lists sorted in the wrong order (the fix), email subjects that arrive garbled (the fix), CSV files that open garbled in Excel (the fix), Japanese titles that give an empty URL slug (the fix), file names garbled on upload and download (the fix), dates in the Japanese era that come out wrong (the fix), public holidays your app gets wrong (the fix), and vertical text that comes out sideways or upside down (the fix).

Lesstep translates web apps into Japanese and delivers them as one pull request. In Complete (US$249), we check every screen in Japanese, and type names and searches with a full-width space in them. The first step is a free sample.

Java is a registered trademark of Oracle and/or its affiliates; Node.js is a trademark of the OpenJS Foundation; Python is a registered trademark of the Python Software Foundation; PostgreSQL is a trademark of the PostgreSQL Community Association of Canada; Google and Chromium are trademarks of Google LLC; Amazon Bedrock is a trademark of Amazon.com, Inc. or its affiliates. This page is not affiliated with or endorsed by any of them.

More: Enter sends the message while typing Japanese · Stripe charges 100 times too much in yen · Kanji in their Chinese shapes · Japanese headings that break in the middle of a word · Forms that reject numbers typed in Japanese · Dates that come out wrong for Japanese users · Address forms in the Japanese order · Japanese phone numbers in forms · Japanese text missing from your PDFs · Search that finds nothing in Japanese · Length limits that break in Japanese · Japanese lists sorted in the wrong order · Japanese email subjects that arrive garbled · Japanese CSV files that open garbled in Excel · Japanese titles that give an empty URL slug · Japanese file names garbled on upload and download · Japanese era dates that come out wrong · Japanese public holidays your app gets wrong · Japanese vertical text that comes out sideways or upside down · Japanese localization checklist · Japanese localization for your web app