473,322 Members | 1,268 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,322 software developers and data experts.

byte[] to string

Hi ALL.
Someone knows how can I convert a byte[] field to a string field?
The problem is, I'm uploading a xml file and I'm requesting the file using
Request.BinaryRead();

So, now I need to convert the result of Request.BinaryRead() method to a
string variable.

Thanks in advance.

FernandoLopes
Nov 16 '05 #1
4 3419
oj
You can take a look at ASCIIEncoding.GetString() method.

--
-oj
"Fernando Lopes" <fernandomattarlopes@[remove]msn.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi ALL.
Someone knows how can I convert a byte[] field to a string field?
The problem is, I'm uploading a xml file and I'm requesting the file using
Request.BinaryRead();

So, now I need to convert the result of Request.BinaryRead() method to a
string variable.

Thanks in advance.

FernandoLopes

Nov 16 '05 #2
Fernando Lopes <fernandomattarlopes@[remove]msn.com> wrote:
Someone knows how can I convert a byte[] field to a string field?


Use Encoding.GetString.

You need to know what encoding the binary data is in though.
See http://www.pobox.com/~skeet/csharp/unicode.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3
Thanks for all!

Fernando

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Fernando Lopes <fernandomattarlopes@[remove]msn.com> wrote:
Someone knows how can I convert a byte[] field to a string field?


Use Encoding.GetString.

You need to know what encoding the binary data is in though.
See http://www.pobox.com/~skeet/csharp/unicode.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #4
If you're going to be transporting your string over the web you should
probably convert your bytes to a Base64 string using
Convert.ToBase64String(byte []) and then get the bytes back on the other end
using Conver.FromBase64String(string).

HTH

DalePres

"Fernando Lopes" <fernandomattarlopes@[remove]msn.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi ALL.
Someone knows how can I convert a byte[] field to a string field?
The problem is, I'm uploading a xml file and I'm requesting the file using
Request.BinaryRead();

So, now I need to convert the result of Request.BinaryRead() method to a
string variable.

Thanks in advance.

FernandoLopes

Nov 16 '05 #5

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

Similar topics

3
by: Nick | last post by:
I have found a class that compresses and uncompresses data but need some help with how to use part of it below is the deflate method which compresses the string that I pass in, this works OK. At...
2
by: Jose Perez | last post by:
Dear All, I have the following problem. I am passing an encrypted value on the querystring from one aspx to another. Originally I was outputing characters such as "+, /,..." (which caused...
2
by: Bryan | last post by:
Apologies if this is a noob question, but I've been struggling with this for quite a while... I'm trying to convert a byte array (encrypted authorization code) into a *screen-printable* string...
8
by: moondaddy | last post by:
I need to convert a byte array to a string and pass it as a parameter in a URL and then convert it back to the original byte array. However, its getting scrambled in the conversion. In short,...
6
by: moondaddy | last post by:
I'm writing an app in vb.net 1.1 and need to convert a byte array into a string, and then from a string back to a byte array. for example Private mByte() as New Byte(4){11,22,33,44} Now how...
4
by: ThunderMusic | last post by:
Hi, I have to go from Byte() to String, do some processing then reconvert the String to byte() but using ascii format, not unicode. I currently use a stream to write the char()...
10
by: Danny | last post by:
I am working on a project where I will receive xml documents from clients machines as a byte array. They will use the web browser navigate method to post the data to my ASP.NET page. I then pick up...
5
by: jeremyje | last post by:
I'm writing some code that will convert a regular string to a byte for compression and then beable to convert that compressed string back into original form. Conceptually I have.... For...
6
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hi, I need to create a formatted byte array for SMPP, e.g.: 00 00 00 21 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 is the length of the entire...
10
by: ShadowLocke | last post by:
I'm looking for a better understanding of whats going on with the code i write. I have come across something that I thought I understood but its not working as expected. Its hard to explain so let me...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.