Convert Byte Array to string

Discussion in 'ASP General' started by Prachi, Nov 4, 2003.

  1. Prachi

    Prachi Guest

    I want to convert the binary data to string.
    I tried doing the same using following peace of code

    Function SimpleBinaryToString(Binary)
    Dim I, S
    For I = 1 To LenB(Binary)
    S = S & Chr(AscB(MidB(Binary, I, 1)))
    Next
    SimpleBinaryToString = S
    End Function

    It works fine when the data is English.
    But when the binary data contains some Japanese characters the
    resultant string gets corrupted.
    Can someone help.
    Thanks in advance.
     
    Prachi, Nov 4, 2003
    #1
    1. Advertising

  2. Prachi

    Evertjan. Guest

    Prachi wrote on 04 nov 2003 in microsoft.public.inetserver.asp.general:

    > I want to convert the binary data to string.
    > I tried doing the same using following peace of code
    >
    > Function SimpleBinaryToString(Binary)
    > Dim I, S
    > For I = 1 To LenB(Binary)
    > S = S & Chr(AscB(MidB(Binary, I, 1)))
    > Next
    > SimpleBinaryToString = S
    > End Function
    >
    > It works fine when the data is English.
    > But when the binary data contains some Japanese characters the
    > resultant string gets corrupted.


    I do not think there is such a thing as a Japanese character in a binary
    string.

    Is there a Japanese equivalent to 8bit(!) ascii ?

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Nov 4, 2003
    #2
    1. Advertising

  3. Prachi

    Prachi R Guest

    Japanese characters are mostly double byte characters.
    The ASCII code of all these characters is generally greater than 255

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Prachi R, Nov 5, 2003
    #3
  4. Prachi

    Evertjan. Guest

    Wrote ..
    > > But when the binary data contains some Japanese characters the
    > > resultant string gets corrupted.

    > I do not think there is such a thing as a Japanese character in a binary
    > string.
    > Is there a Japanese equivalent to 8bit(!) ascii ?


    Prachi R wrote on 05 nov 2003 in microsoft.public.inetserver.asp.general:
    > Japanese characters are mostly double byte characters.
    > The ASCII code of all these characters is generally greater than 255


    So they do not exist in a byte string.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Nov 6, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kirby
    Replies:
    3
    Views:
    653
    Kirby
    Oct 8, 2004
  2. Shane Wealti

    convert byte[] to Byte[]

    Shane Wealti, Jun 13, 2005, in forum: Java
    Replies:
    5
    Views:
    42,261
    Brzezi
    Jun 13, 2005
  3. Replies:
    20
    Views:
    9,813
    licebmi
    Sep 7, 2009
  4. Polaris431
    Replies:
    8
    Views:
    762
    SM Ryan
    Dec 4, 2006
  5. M D

    convert 2 byte space to one byte

    M D, Oct 6, 2006, in forum: Javascript
    Replies:
    3
    Views:
    198
    Dr John Stockton
    Oct 6, 2006
Loading...

Share This Page