Japanese Postal Code Normalization: 〒150-0002, Full-Width Digits & Hyphen Variants
Japanese mobile keyboards emit full-width numerals, 〒 symbols, and six distinct dash characters. A 3-line NFKC sanitizer prevents massive checkout drop-off in Japan.
1. Why Strict /^\d{3}-\d{4}$/ Rejects Real Japanese Buyers
On iOS and Android Japanese IMEs, users routinely type full-width digits (150−0002), paste the postal mark (〒150-0002), or type the kana long vowel mark (150ー0002) because it sits on the main keyboard row. A raw ASCII regex rejects every one of these inputs.
export function normalizeJpPostal(input) {
const nfkc = String(input ?? '').normalize('NFKC').trim();
const clean = nfkc
.replace(/^〒\s*/, '')
.replace(/[‐‑‒–—―\u30FC]/g, '-')
.replace(/\s+/g, '');
if (/^\d{7}$/.test(clean)) {
return `${clean.slice(0, 3)}-${clean.slice(3)}`;
}
return clean;
} 2. Dual-Script Testing: Kanji, Katakana & Romaji
Domestic Japan Post labels follow big-endian order (〒150-0002 東京都渋谷区渋谷2丁目-14-3), whereas international DHL/FedEx manifests require ASCII Romaji (Shibuya 2-chome-14-3, Shibuya-ku, Tokyo 150-0002). Use AddressBench Dual, Native, and ASCII script modes to test both pipelines.