views:

344

answers:

4

I'm attempting to display some text in my program using (say) Windows GDI and some of the unicode characters are displayed as boxes? What is up?

See also: What does it mean when my text is displayed as Question Marks?

+5  A: 

Usually, that means that the unicode character specified isn't available in that particular font. Try changing fonts to one of the multinational ones, it should go away.

Tim Howland
A: 

The deal is that the text you are trying to display includes characters that are not supported in the font you are using. The box character is the default substitution character for Unicode text that does not have a glyph in the font.

On Windows, if you are trying to display text in a range of different languages, use a font such as Arial Unicode MS - this includes glyphs for a vast array of different languages. It is a "least common denominator" font - the glyphs will generally be there, but it generally lacks character and some of the glyphs will look a little weird next to each other.

1800 INFORMATION
+8  A: 

Greg Hewgill
+2  A: 

In Windows there are 2 common display problems that occur when trying to display Unicode characters:

  1. text sometimes appears as question marks

    • This occurs when Unicode data is converted to an 8-bit character set encoding (or technically multi-byte characters) usually via the system codepage (but other code pages can be specified in the conversion calls). If the target 8-bit character set doesn't included the characters needed, any characters not representable in the target character set get converted to question marks.
  2. text sometimes appears as boxes

    • This is a problem with the font not having the glpyh for a particular character. Boxes show up when there is a mismatch between Unicode characters in the document and those supported by the font. Specifically, the boxes represent characters not supported by the selected font.
Michael Burr