开发者

Android: Character appearing as a box

I have an app displaying Japanese characters but for some reason, the tilde (~) character is displaying as a box (which looks like this, but one character: []).

This is after i apply the text to a TextView. I got the text from a JSON string.

The thing that disturbs me is, aren't Java strings unicode? Anyone know what i need to开发者_C百科 fix?

characters = getCharacterFromJSON();

// set character
TextView charTextView = (TextView)findViewById(R.id.characterView);
charTextView.setText(characters);

Android: Character appearing as a box

// Ack! all my ~'s are []!

EDIT: it's not a tilde(~), it's a japanese character (〜), which indicates these characters are a suffix. It's still not showing though.


Most probably a font issue. The default font that comes with most Android devices doesn't properly support all Japanese characters: some kanji are shown using the Chinese glyph, more obscure characters are not displayed at all (boxes). You have a few options:

  • if this is for your own use, and you have are rooted phone, install the DroidSansJapanese.ttf font (copy to /system/fonts)
  • if it's an app you want to distribute, bundle the font in assets, and set your text views to use it
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜