From: Tony Johansson on
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[i] = (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


From: Jackie on
Tony Johansson wrote:
> 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[i] = (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).

--
Regards,
Jackie
From: Peter Duniho on
Tony Johansson wrote:
> 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
From: Mihai N. on
> 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.


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email