ASCII Problem in VB.Net no character greater than 127
Author |
Message |
Bryan O. Zarzuel #1 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Hi guys, I'm new here. I searched for a similar problem to this before asking but didn't find anything so I'm posting this question. In VB.Net, I'm using the RS232 class I got from MSDN to access the serial port. I'm trying to output &HFE by using Write(chr(254)) Problem is, it always outputs as 3F (127) so I tried to loop through all the ASCII codes (0 to 255) and looked at the data through a port monitor. It showed that all outputs greater than 127 defaulted to 127. I thought it was a problem with my system (WinXP Pro SP1) so I wrote a little program in QBASIC. I can output up to 255 in QBASIC. So now, my suspect is the encoding. Unfortunately, I only know little about Encoding in VB.Net. Can you guys help me out? Thanks.
|
Wed, 14 Sep 2005 11:50:50 GMT |
|
 |
Michael Picku #2 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Look at the definition of ASCIIEncoding in the Framework. It is 0 to 127. Mike Pickus
Quote: > Hi guys, > I'm new here. I searched for a similar problem to this > before asking but didn't find anything so I'm posting > this question. > In VB.Net, I'm using the RS232 class I got from MSDN to > access the serial port. > I'm trying to output &HFE by using Write(chr(254)) > Problem is, it always outputs as 3F (127) so I tried to > loop through all the ASCII codes (0 to 255) and looked at > the data through a port monitor. It showed that all > outputs greater than 127 defaulted to 127. > I thought it was a problem with my system (WinXP Pro SP1) > so I wrote a little program in QBASIC. I can output up to > 255 in QBASIC. > So now, my suspect is the encoding. Unfortunately, I only > know little about Encoding in VB.Net. Can you guys help > me out? Thanks.
|
Wed, 14 Sep 2005 19:52:52 GMT |
|
 |
michk #3 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Sorry, if its > 127 (0x7f) then it is not ASCII. This is by design. If you want codes beyong 127 then you need to either treat it as binary (which it appears to be?) or treat it as some other encoding. -- MichKa [MS] This posting is provided "AS IS" with no warranties, and confers no rights.
Quote: > Hi guys, > I'm new here. I searched for a similar problem to this > before asking but didn't find anything so I'm posting > this question. > In VB.Net, I'm using the RS232 class I got from MSDN to > access the serial port. > I'm trying to output &HFE by using Write(chr(254)) > Problem is, it always outputs as 3F (127) so I tried to > loop through all the ASCII codes (0 to 255) and looked at > the data through a port monitor. It showed that all > outputs greater than 127 defaulted to 127. > I thought it was a problem with my system (WinXP Pro SP1) > so I wrote a little program in QBASIC. I can output up to > 255 in QBASIC. > So now, my suspect is the encoding. Unfortunately, I only > know little about Encoding in VB.Net. Can you guys help > me out? Thanks.
|
Wed, 14 Sep 2005 23:27:43 GMT |
|
 |
Tom Spin #4 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Hi Bryan, Try using the ChrW function to do this, just a thought. -- Remember: There's no place like 127.0.0.1 ============================================== Happy To Help, Tom Spink
http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code Happy Coding!! Please respond to the newsgroups, so all can benefit. One day
Quote: > Hi guys, > I'm new here. I searched for a similar problem to this > before asking but didn't find anything so I'm posting > this question. > In VB.Net, I'm using the RS232 class I got from MSDN to > access the serial port. > I'm trying to output &HFE by using Write(chr(254)) > Problem is, it always outputs as 3F (127) so I tried to > loop through all the ASCII codes (0 to 255) and looked at > the data through a port monitor. It showed that all > outputs greater than 127 defaulted to 127. > I thought it was a problem with my system (WinXP Pro SP1) > so I wrote a little program in QBASIC. I can output up to > 255 in QBASIC. > So now, my suspect is the encoding. Unfortunately, I only > know little about Encoding in VB.Net. Can you guys help > me out? Thanks.
|
Wed, 14 Sep 2005 23:47:21 GMT |
|
 |
michk #5 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Hi Tom, ChrW into an ASCIIEncoding will have the same problem. -- MichKa [MS] This posting is provided "AS IS" with no warranties, and confers no rights.
Quote: > Hi Bryan, Try using the ChrW function to do this, just a thought. > -- > Remember: There's no place like 127.0.0.1 > ============================================== > Happy To Help, > Tom Spink
> http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code > Happy Coding!! > Please respond to the newsgroups, so all can benefit. > One day
> > Hi guys, > > I'm new here. I searched for a similar problem to this > > before asking but didn't find anything so I'm posting > > this question. > > In VB.Net, I'm using the RS232 class I got from MSDN to > > access the serial port. > > I'm trying to output &HFE by using Write(chr(254)) > > Problem is, it always outputs as 3F (127) so I tried to > > loop through all the ASCII codes (0 to 255) and looked at > > the data through a port monitor. It showed that all > > outputs greater than 127 defaulted to 127. > > I thought it was a problem with my system (WinXP Pro SP1) > > so I wrote a little program in QBASIC. I can output up to > > 255 in QBASIC. > > So now, my suspect is the encoding. Unfortunately, I only > > know little about Encoding in VB.Net. Can you guys help > > me out? Thanks.
|
Thu, 15 Sep 2005 02:15:34 GMT |
|
 |
Tom Spin #6 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Ah, I see. Just a thought. :) -- Remember: There's no place like 127.0.0.1 ============================================== Happy To Help, Tom Spink
http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code Happy Coding!! Please respond to the newsgroups, so all can benefit. One day
Quote: > Hi Tom, > ChrW into an ASCIIEncoding will have the same problem. > -- > MichKa [MS] > This posting is provided "AS IS" with > no warranties, and confers no rights.
> > Hi Bryan, Try using the ChrW function to do this, just a thought. > > -- > > Remember: There's no place like 127.0.0.1 > > ============================================== > > Happy To Help, > > Tom Spink
> > http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code > > Happy Coding!! > > Please respond to the newsgroups, so all can benefit. > > One day
> > > Hi guys, > > > I'm new here. I searched for a similar problem to this > > > before asking but didn't find anything so I'm posting > > > this question. > > > In VB.Net, I'm using the RS232 class I got from MSDN to > > > access the serial port. > > > I'm trying to output &HFE by using Write(chr(254)) > > > Problem is, it always outputs as 3F (127) so I tried to > > > loop through all the ASCII codes (0 to 255) and looked at > > > the data through a port monitor. It showed that all > > > outputs greater than 127 defaulted to 127. > > > I thought it was a problem with my system (WinXP Pro SP1) > > > so I wrote a little program in QBASIC. I can output up to > > > 255 in QBASIC. > > > So now, my suspect is the encoding. Unfortunately, I only > > > know little about Encoding in VB.Net. Can you guys help > > > me out? Thanks.
|
Thu, 15 Sep 2005 03:14:04 GMT |
|
 |
Dick Grie #7 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Hi, I'm not sure about the class that you obtained from MSDN, but you can use NETComm.ocx (free) from my homepage -- this is equivalent to MSComm32. Or, you can use the native VB .NET class that is in my book, and on the accompanying CD-ROM. It supports both ASCII text and binary data. Dick -- Richard Grier (Microsoft Visual Basic MVP) See www.hardandsoftware.net for contact information. Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
|
Thu, 15 Sep 2005 03:31:26 GMT |
|
 |
michk #8 / 8
|
 ASCII Problem in VB.Net no character greater than 127
Hi{*filter*}, ASCII text is still never > 127, even in your class (unless the class is misnamed <grin>). ASCII is 0x00-0x7f (a.k.a. 0-127) only. -- MichKa [MS] This posting is provided "AS IS" with no warranties, and confers no rights.
Quote: > Hi, > I'm not sure about the class that you obtained from MSDN, but you can use > NETComm.ocx (free) from my homepage -- this is equivalent to MSComm32. Or, > you can use the native VB .NET class that is in my book, and on the > accompanying CD-ROM. It supports both ASCII text and binary data. >{*filter*} > -- > Richard Grier (Microsoft Visual Basic MVP) > See www.hardandsoftware.net for contact information. > Author of Visual Basic Programmer's Guide to Serial Communications, 3rd > Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
|
Thu, 15 Sep 2005 03:59:36 GMT |
|
|
|