CJK and Latin spacing
Adds a space where Chinese or Japanese text meets Latin letters or numbers, e.g. 用Python写5个脚本 becomes 用 Python 写 5 个脚本.
Rules
- CJK means Han characters, hiragana, katakana and the iteration mark 々. Hangul is left alone, since Korean already uses spaces between words.
- A space is added between a CJK character and an adjacent Latin letter (including accented ones), and optionally a digit.
- With symbols on,
%,+and#count as part of the Latin side when they follow a letter or digit and come before CJK (50%的, C++写), and#,@and$when they come after CJK and precede a letter or digit (见#12, 花$5). A symbol between two CJK characters, as in 话题#标签, is left alone. - Nothing is added next to full-width punctuation such as ,。(), and existing spaces are kept as they are.
Runs in your browser; nothing is uploaded.