开发者

How to get ZWJ (Zero-width Joiner) entity to work with Japanese characters?

Is there any way to get the zero-width joiner character (‍ / ‍ / ‍) to work with Japanese characters? Or is there a similar solution that doesn't involve wrapping characters in HTML tags?

I want to reproduce the result of a pre/nobr/white-space:nowrap but without wr开发者_JAVA百科apping the individual character. I also want to do this only to select groups of characters (to avoid wrapping in the middle of a word).

Example: http://jsfiddle.net/GbvFk/1/

or: 日‍本‍の‍サ‍ン‍プ‍ル‍テ‍キ‍ス‍ト

I have these strings in i18n properties files, where they look like JS escapes (\u65E5\u200D, etc)

Thanks!


ZWJ doesn't do what you want, zero-width joiner works only on "complex scripts" like Arabic, it doesn't just hold the characters side by side, it actually joins the shapes.

I think the best and cleanest way to do this is exactly to wrap any multi-character word you don't want to break in a nowrap span.

Also something to consider is that no robot expects some weird character be in the middle of any two characters so if your pages are going to be online no search engine will be able to read them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜