From: msnews.microsoft.com on
Hi
Im trying to Create A terminal window
how can i get the Extended characters like used in dos
code page 437
(box draw characters)
Lucinda Console Font has them , this works in notepad when i tested
but when i try it in TextBox or RichTextBox
I get ? or + some replacement Character

any help would be good
thank you



From: Peter Duniho on
msnews.microsoft.com wrote:
> Hi
> Im trying to Create A terminal window
> how can i get the Extended characters like used in dos
> code page 437
> (box draw characters)
> Lucinda Console Font has them , this works in notepad when i tested
> but when i try it in TextBox or RichTextBox
> I get ? or + some replacement Character

If you are using a font with glyphs for the characters, and you are
using the correct character codes, it will work. Otherwise it won't.

If it's not working for you, obviously you have failed to meet one or
both of those criteria. But if you don't post a concise-but-compete
code example, there's no way for anyone to tell you what's wrong.

Pete
From: msnews.microsoft.com on
Thanks for Replying Peter
Im in the Vs2008 Designer
TextBox Control with font set to lucinda Console
a PushButton

public Button1_Click(object sender,EventArgs e)
{
this.tx1.Text.Append(((char)216).ToString())
}

the above right now is all im doing...
lucinda console font shows the extended character set

i dont know what code u need to see..since ive wrote not that even works

Thanks

"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> wrote in message
news:uvCB5lGoKHA.1556(a)TK2MSFTNGP05.phx.gbl...
> msnews.microsoft.com wrote:
>> Hi
>> Im trying to Create A terminal window
>> how can i get the Extended characters like used in dos
>> code page 437
>> (box draw characters)
>> Lucinda Console Font has them , this works in notepad when i tested
>> but when i try it in TextBox or RichTextBox
>> I get ? or + some replacement Character
>
> If you are using a font with glyphs for the characters, and you are using
> the correct character codes, it will work. Otherwise it won't.
>
> If it's not working for you, obviously you have failed to meet one or both
> of those criteria. But if you don't post a concise-but-compete code
> example, there's no way for anyone to tell you what's wrong.
>
> Pete


From: Peter Duniho on
msnews.microsoft.com wrote:
> Thanks for Replying Peter
> Im in the Vs2008 Designer
> TextBox Control with font set to lucinda Console
> a PushButton
>
> public Button1_Click(object sender,EventArgs e)
> {
> this.tx1.Text.Append(((char)216).ToString())
> }
>
> the above right now is all im doing...

Not that the above actually would compile, but�what is the output when
you run code like that? I would expect this character: �

Is that the character you wanted?

If you want the graphics characters, you need to use the correct Unicode
value for them. And frankly, you should just use the \u escape for
character literals rather than casting.

The character found at the value 216 in extended ASCII character
encodings is actually Unicode 0x2588. The other characters are in that
general range as well (you can use the Character Map program in Windows,
or similar references, to find exact Unicode values for specific
characters).

So if you want the "solid block" character, you need to use this instead:

public Button1_Click(object sender,EventArgs e)
{
this.tx1.Text.Append('\u2588');
}

If you want to work in an extended ASCII character encoding, then you
need to create your characters in a byte array and then use the Encoding
class to convert to Unicode from whatever extended ASCII encoding you've
chosen to work with (e.g. IBM437, ibm850, ISO-8859-1, etc.). That could
be worthwhile if you are receiving characters from some remote client,
such as what might happen in an actual terminal application. (Of
course, in that case you'll be forced to use whatever encoding is being
received from the remote client).

Otherwise, you should just use the correct Unicode values from the outset.

Pete
From: Peter Duniho on
Peter Duniho wrote:
> [...]
> The character found at the value 216 in extended ASCII character
> encodings is actually Unicode 0x2588. The other characters are in that
> general range as well (you can use the Character Map program in Windows,
> or similar references, to find exact Unicode values for specific
> characters).

I should be more clear about the above:

The mapping from character 216 to Unicode character 0x2588 is _only_
valid for specific extended ASCII character encodings. Only if you know
the specific encoding is it possible to say for sure what the equivalent
Unicode character is, and there are non-Unicode encodings out there for
which 216 is either not even a valid character, or for which 216 maps to
a different Unicode character than 0x2588.

Pete