Hi,
I am developing an test application to read the data coming on serial port sent by the pabx.
It is working fine. But, for some reason , i don't know why, some invalid characters are coming in the data, something like '?'
On hyperterminal i can see data in the following format
02/06/10 08:52AM 100 01 0975895420 00:00'10
But in my application it comes in the following format
0??06??0?08:5?AM????00?0??09?5?95??0?????????????????????00:00'??????????????????
Please help me.
Thanks in advance.
Invalid Characters in Serial Port Data
Page 1 of 11 Replies - 1733 Views - Last Post: 10 June 2010 - 12:18 AM
Replies To: Invalid Characters in Serial Port Data
#2
Re: Invalid Characters in Serial Port Data
Posted 10 June 2010 - 12:18 AM
hi i think it is the encoding. i read somewhere that if the character is unknown the byte is replaced with H3F(the question mark). i find the article:
http://social.msdn.m...d4-7db0786036e5
you can change the encoding like so:
that is if you want to use cp1251 encoding.
hope it helps you
http://social.msdn.m...d4-7db0786036e5
you can change the encoding like so:
Dim strTmpRsInput As String = String.Empty
Dim bytRecivedBuffer() As Byte
Com.Encoding = System.Text.Encoding.GetEncoding("Windows-1251")
strTmpRsInput = strTmpRsInput & Com.ReadExisting
bytRecivedBuffer = System.Text.Encoding.GetEncoding("Windows-1251").GetBytes(strTmpRsInput)
that is if you want to use cp1251 encoding.
hope it helps you
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|