erik
erik

Reputation: 4958

Zero-width space with special characters

Interesting problem here, wondering if anyone has come across it.

I am building an Android app that has some special characters as text (mainly Japanese characters) and our designers want some soft returns strategically placed, incase the text needs to wrap due to width limitations on smaller devices.

The problem is that since the text is essentially Japanese, there are no spaces between words.

I know we can use \u200b as a zero-width space resulting in a string like this:

abcdef\u200bghijklmnop

appearing like this when there is enough room:

abcdefghijklmnop

and like this if it needs to wrap:

abcdef
ghijklmnop

The problem is that if instead of standard English characters, we use Japanese characters it doesn't seem to work. We don't get soft line breaks at all. It instead always breaks right where it runs out of space regardless of where we put the \u200b

ヘルプヘルプ\u200bヘルプヘルプ

results in:

ヘルプヘルプヘルプヘ
ルプ

Has anyone dealt with this before or have any ideas on how to solve this?

Upvotes: 10

Views: 1313

Answers (0)

Related Questions