473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 16117
"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.ASCIIEncoding.GetString'.

--
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(buffer)
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**************@TK2MSFTNGP05.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.ASCIIEncoding.GetString'.

--
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(buffer)
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.ASCIIEncoding = New
System.Text.ASCIIEncoding()
Dim charCount As Integer = ascii.GetCharCount(bytes, 6, 8)
chars = New Char(charCount) {}
Dim charsDecodedCount As Integer = ascii.GetChars(bytes, 6, 8,
chars, 0)
MsgBox("{0} characters used to decode bytes.", charsDecodedCount)
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****************@TK2MSFTNGP04.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****************@TK2MSFTNGP04.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.ASCIIEncoding.GetString' 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*****@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
That didn't work (VS2003 didn't know that), but I found this:
Encoding.ASCII.GetString(buffer)
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
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...
30
by: John Carroll | last post by:
Does anyone have a function or procedure for converting integers to character strings? Thank you, John
6
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...
4
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
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
by: Allan Ebdrup | last post by:
How do I easily convert a int to a string? Kind Regards, Allan Ebdrup
3
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...
8
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...
19
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.