Re: Converting a string to an array of bytes.
- From: "Christof Nordiek" <cn@xxxxxxxxx>
- Date: Wed, 10 Jan 2007 13:54:38 +0100
Hi,
youv'e got to use the right Encoding. for your problem the codepage of the
System should work.
try:
bytes = System.Text.Encoding.Default.GetBytes(inputstring);
hth
"Riaan" <Riaan@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:027DBBDE-1433-4700-87E9-8ED0B01D2252@xxxxxxxxxxxxxxxx
Hi,
I am working on an app where I need to get user input which defines an
rs232
based protocol.
The user must be able to type in a string of characters that include non
standard keyboard characters such as aschii charater 159.
In the old VB apps I worked one could type into a text box something like
alt+159 (displayed as 'f') and when converting that string to a byte array
you would get an array with one element with the byte value 159.
Now, using C#, I can not for the love of money do the same. When I do the
converson I get an array with bytes that contain more bytes than the
number
of characters in the original string and none of these byte values are the
correct ones.
--
I have a plan so cunning you could pin a tail on it and call it a weasel.
.
- Follow-Ups:
- Re: Converting a string to an array of bytes.
- From: Christof Nordiek
- Re: Converting a string to an array of bytes.
- Prev by Date: Re: Converting a string to an array of bytes.
- Next by Date: Re: Converting a string to an array of bytes.
- Previous by thread: Re: Converting a string to an array of bytes.
- Next by thread: Re: Converting a string to an array of bytes.
- Index(es):
Relevant Pages
|