Re: Convert from byte array to string
From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 11/04/04
- Next message: Loïc Delambre: "Call NetMessageBufferSend from a c# service return 2273 error"
- Previous message: Alejandro: "From Java and Delphi to C#"
- In reply to: Ricardo Quintanilla: "Convert from byte array to string"
- Next in thread: Ricardo Quintanilla: "Re: Convert from byte array to string"
- Reply: Ricardo Quintanilla: "Re: Convert from byte array to string"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Nov 2004 09:12:19 -0500
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: Loïc Delambre: "Call NetMessageBufferSend from a c# service return 2273 error"
- Previous message: Alejandro: "From Java and Delphi to C#"
- In reply to: Ricardo Quintanilla: "Convert from byte array to string"
- Next in thread: Ricardo Quintanilla: "Re: Convert from byte array to string"
- Reply: Ricardo Quintanilla: "Re: Convert from byte array to string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|