473,549 Members | 2,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert byte() in ASCII code to letters?

Hi,

I have a 1 dimensional table byte with a number af characters in ASCII code.
How do I convert those ASCII codes to real letters?

Thanks
May 14 '06 #1
7 16164
"Joris De Groote" <jo************ @skynet.be> schrieb:
I have a 1 dimensional table byte with a number af characters in ASCII
code. How do I convert those ASCII codes to real letters?


'System.Text.AS CIIEncoding.Get String'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 14 '06 #2
That didn't work (VS2003 didn't know that), but I found this:
Encoding.ASCII. GetString(buffe r)
However, the result is always empty (I checked the table and the values are
in the table)
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> schreef in bericht
news:OK******** ******@TK2MSFTN GP05.phx.gbl...
"Joris De Groote" <jo************ @skynet.be> schrieb:
I have a 1 dimensional table byte with a number af characters in ASCII
code. How do I convert those ASCII codes to real letters?


'System.Text.AS CIIEncoding.Get String'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 14 '06 #3
> That didn't work (VS2003 didn't know that), but I found this:
Encoding.ASCII. GetString(buffe r)
However, the result is always empty (I checked the table and the values are
in the table)


I think GetString stops on the first zero byte. Is buffer(0) equal to zero?
May 15 '06 #4
Dim chars() As Char
Dim bytes() As Byte = New Byte() {65, 83, 67, 73, 73, 32, 69, 110,
99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101}
Dim ascii As System.Text.ASC IIEncoding = New
System.Text.ASC IIEncoding()
Dim charCount As Integer = ascii.GetCharCo unt(bytes, 6, 8)
chars = New Char(charCount) {}
Dim charsDecodedCou nt As Integer = ascii.GetChars( bytes, 6, 8,
chars, 0)
MsgBox("{0} characters used to decode bytes.", charsDecodedCou nt)
MsgBox("Decoded chars: ")
Dim c As Char
For Each c In chars
MsgBox("[{0}]" & vbTab & c)
Next

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Joris De Groote" <jo************ @skynet.be> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Hi,

I have a 1 dimensional table byte with a number af characters in ASCII
code. How do I convert those ASCII codes to real letters?

Thanks

May 15 '06 #5
Joris,

Know that ASCII is (7 bits). In the Benelux is that in my opinion seldom
used.

Cor

"Joris De Groote" <jo************ @skynet.be> schreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Hi,

I have a 1 dimensional table byte with a number af characters in ASCII
code. How do I convert those ASCII codes to real letters?

Thanks

May 15 '06 #6
Probably all you need to get VS2003 to know
'System.Text.AS CIIEncoding.Get String' is an 'Imports System' at the
beginning of your program.

May 15 '06 #7
Hi,
it seems to stop at every 0
so I createdan if that changes 0's into spaces and now everything is OK.
Thanks!
"AMercer" <AM*****@discus sions.microsoft .com> wrote in message
news:F4******** *************** ***********@mic rosoft.com...
That didn't work (VS2003 didn't know that), but I found this:
Encoding.ASCII. GetString(buffe r)
However, the result is always empty (I checked the table and the values
are
in the table)


I think GetString stops on the first zero byte. Is buffer(0) equal to
zero?

May 16 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
4755
by: Bill Cunningham | last post by:
I've been reading the C standard online and I'm puzzled as to what multibyte chars are. Wide chars I believe would be characters for languages such as cantonese or Japanese. I know the ASCII character set specifies that each character such as 'b' or 'B' is an 8 bit character. So what's a multibyte character? Also how would you use the...
30
8619
by: John Carroll | last post by:
Does anyone have a function or procedure for converting integers to character strings? Thank you, John
6
10154
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that the data converted from the byte array into a string , is not what i expect. example: - the data returned from the socket is (byte array)...
4
4697
by: Ping | last post by:
Hi, All, We can use BitConverter.ToString(byte) to a string, but how to get the byte from a string like "AD-A6-0D-1F"?
15
34568
by: Kueishiong Tu | last post by:
How do I convert a Byte array (unsigned char managed) to a char array(unmanaged) with wide character taken into account?
6
12744
by: Allan Ebdrup | last post by:
How do I easily convert a int to a string? Kind Regards, Allan Ebdrup
3
32046
by: Director - Minvent | last post by:
Hi, I am reading from a serial port from a device which sends over an ascii character. It uses the full extended 256 character set and therefore has non-printing characters too. So what i want to do is convert the input to the associated decimal. I.E ASCII Char 'NUL' will become 0 ASCII Char 'SOH' will become 1
8
14279
by: davihigh | last post by:
My Friends: I am using std::ofstream (as well as ifstream), I hope that when i wrote in some std::string(...) with locale, ofstream can convert to UTF-8 encoding and save file to disk. So does ifstream. Something I found shows that, I need to have a proper codecvt to set it. I need more information, maybe a small piece of code sample....
19
5316
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that str(object) does not always attempt to return a string that is acceptable to eval(); its goal is to return a printable string. If no argument is given,...
0
7521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7473
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1944
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.