WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add a space between a Chinese character and a letter or a number to make the article more readable.

For example:


Google 与 Apple 展开的专利大战在 2 天之前结束。

But add the space manually is a hard work. How can I do it automatically? Maybe with CSS?

share|improve this question
Wow, a heck of a Question! Would be nice if you added related resources that you found while researching for this problem. ::: I only know of one person who can answer this. ::: And it would not be CSS (maybe impossible?), but WP/PHP... – brasofilo Jan 21 '13 at 8:42
up vote 6 down vote accepted

Interesting question. This could be a useful part of a specific language file. It cannot be done in CSS, because CSS is (mostly) character agnostic. But using a filter and PHP it is possible and on topic:

add_filter( 'the_content', 't5_chinese_spacing' );

function t5_chinese_spacing( $content )
    return preg_replace(
        '\1 \2 \3',

Be aware your internal encoding has to be UTF-8 to make that work. While WordPress works with other encodings too, PHP needs UTF-8 for this. Read WordPress Database Charset and Collation Configuration to make sure everything is set up properly.

Also note I am using PHP’s character class for Han unification here. This is not perfect, some punctuation marks Chinese writers might use are not included.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.