Re: Convert from byte array to string
From: Ricardo Quintanilla (RicardoQuintanilla_at_discussions.microsoft.com)
Date: 11/04/04
- Next message: Bonj: "Windows service accessing the network"
- Previous message: Ralph: "Re: programatically sending email"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Convert from byte array to string"
- Next in thread: Nicholas Paldino [.NET/C# MVP]: "Re: Convert from byte array to string"
- Reply: Nicholas Paldino [.NET/C# MVP]: "Re: Convert from byte array to string"
- Reply: Morten Wennevik: "Re: Convert from byte array to string"
- Reply: Rafael Pereyra: "Re: Convert from byte array to string"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Nov 2004 07:38:02 -0800
First all, thanks Nicholas.
i have no problem with the data sent to as400 socket, my problem is with the
data received as response when i try to convert it from "byte array" to
string, some characters are wrong converted.
i am using the NetworkStream class in order to send/receive data over a
TcpClient instance class.
how can i apply your advice?
-- Ricardo Quintanilla G. "Nicholas Paldino [.NET/C# MVP]" wrote: > Ricardo, > > It would seem to me that you are using the wrong encoding, or you need > to specify the correct code page for the encoder. Are you sure that the > bytes being sent are ASCII encoded? > > > -- > - Nicholas Paldino [.NET/C# MVP] > - mvp@spam.guard.caspershouse.com > > "Ricardo Quintanilla" <RicardoQuintanilla@discussions.microsoft.com> wrote > in message news:5C9EB410-9D3E-4A58-B635-CFDA1457B92F@microsoft.com... > >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) > > "Usuario Sin Atribuciones Para Esta Función" > > > > - the data obtained from the convert process is (a string) > > "Usuario Sin Atribuciones Para Esta Funcisn" > > > > look at the last word, it have an accent, but when i convert it, the > > accent > > is loosed. > > > > > > i am using then next code, in order to convert the byte array to string > > > > ----------------------------------------------------------------------- > > string dataReceivedinText = Encoding.ASCII.GetString(bytesDataReceived); > > ----------------------------------------------------------------------- > > > > what can i do, in order to solve my problem? > > any suggestion? > > > > many thanks > > > > > > -- > > Ricardo Quintanilla G. > > >
- Next message: Bonj: "Windows service accessing the network"
- Previous message: Ralph: "Re: programatically sending email"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Convert from byte array to string"
- Next in thread: Nicholas Paldino [.NET/C# MVP]: "Re: Convert from byte array to string"
- Reply: Nicholas Paldino [.NET/C# MVP]: "Re: Convert from byte array to string"
- Reply: Morten Wennevik: "Re: Convert from byte array to string"
- Reply: Rafael Pereyra: "Re: Convert from byte array to string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|