When the code is chines/ japan or some other I get square boxes

T

Tony Johansson

Hi!

When I run this code below I get square boxes for some code point what does
this mean. ?
I get square boxes for chinese/japanese and some other.
I would say that when the code page exist why is not windows able to display
the character for this code point.
Is it because of the driver to the screen does not support these characters.
I'm just curious ?

byte[] b = new Byte[256];
for (int i = 0; i < b.Length; i++)
b = (byte)i;

EncodingInfo[] ei = Encoding.GetEncodings();
foreach(EncodingInfo e in ei)
{
string s = Encoding.GetEncoding(e.CodePage).GetString(b, 32,
224);
MessageBox.Show(e.DisplayName);
MessageBox.Show(s);
}

//Tony
 
J

Jackie

Tony said:
Hi!

When I run this code below I get square boxes for some code point what does
this mean. ?
I get square boxes for chinese/japanese and some other.
I would say that when the code page exist why is not windows able to display
the character for this code point.
Is it because of the driver to the screen does not support these characters.
I'm just curious ?

byte[] b = new Byte[256];
for (int i = 0; i< b.Length; i++)
b = (byte)i;

EncodingInfo[] ei = Encoding.GetEncodings();
foreach(EncodingInfo e in ei)
{
string s = Encoding.GetEncoding(e.CodePage).GetString(b, 32,
224);
MessageBox.Show(e.DisplayName);
MessageBox.Show(s);
}

//Tony


It must be a problem on your computer.

Does Chinese and Japanese text render fine otherwise?
ã‚ã„ã†ãˆãŠ
These five (Japanese) characters for instance, should look like the ones
at the top row here:
http://www.silba.co.kr/jmbh/2047_01.gif
They should by default render correctly in Windows Vista and 7, but not
in XP unless you have installed support for East Asian languages.

Tried the code on my computer (with Windows 7) and text renders fine
with that code:
http://i47.tinypic.com/2pu018i.jpg

May be a font issue as well, but I doubt it. I think it might use a
different font to render that text (if available).
 
P

Peter Duniho

Tony said:
Hi!

When I run this code below I get square boxes for some code point what does
this mean. ?
I get square boxes for chinese/japanese and some other.
I would say that when the code page exist why is not windows able to display
the character for this code point.
Is it because of the driver to the screen does not support these characters.
I'm just curious ?

In addition to Jackie's answer, keep in mind that you need to be
displaying the text using a font that has glyphs for those characters.
I would guess that the default font for the MessageBox class doesn't,
unless your system is configured with the International settings set for
Japanese (for example).

Pete
 
M

Mihai N.

When I run this code below I get square boxes for some code point what does
this mean. ?
I get square boxes for chinese/japanese and some other.
I would say that when the code page exist why is not windows able
to display the character for this code point.
Is it because of the driver to the screen does not support these
characters.
I'm just curious ?

First you have to make sure the characters are really Chinese/Japanese.
Converting a bunch of bytes with all the code pages is unlikely to
produce valid characters.

If that is ok, then the problem is the font.
Do you have Chinese/Japanese support installed?

On XP make sure you check the "Install files for East Asian languages"
in "Regional and Language Options" - "Languages" tab:
http://linguistic.artofcode.nl/wp-content/regional_and_language_options.png

On Vista/Win 7 all the support is there by default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top