Convert from byte array to string

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ricardo Quintanilla (RicardoQuintanilla_at_discussions.microsoft.com)
Date: 11/04/04


Date: Thu, 4 Nov 2004 06:04:06 -0800

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.


Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: Convert from byte array to string
    ... i have no problem with the data sent to as400 socket, ... Ricardo Quintanilla G. ... >> the socket responds to me as a "byte array". ... >> then i need to convert the "byte array" into a string. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: TCP/IP Sockets with GNAT.Sockets
    ... the problem is the use of attributes 'Output on arrays which output array bounds before array data. ... and since String is an array, String'Output outputs String bounds before string data. ... you should note that the problem is the same in C: when reading a string from a socket, ... Streams while a Socket package isn't required to give any explanations ...
    (comp.lang.ada)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)