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. Advertisements

  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. Advertisements

  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. Advertisements

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. Paul W
    Replies:
    1
    Views:
    1,697
    Bryant Hankins
    Aug 6, 2004
  2. Kirby
    Replies:
    3
    Views:
    942
    Kirby
    Oct 8, 2004
  3. Replies:
    20
    Views:
    10,552
    licebmi
    Sep 7, 2009
  4. reju
    Replies:
    3
    Views:
    2,595
    RichZilla
    Mar 8, 2007
  5. Replies:
    17
    Views:
    2,014
    Tim Rentsch
    Jun 15, 2005
  6. Polaris431
    Replies:
    8
    Views:
    1,022
    SM Ryan
    Dec 4, 2006
  7. Replies:
    2
    Views:
    682
    Martijn
    Apr 11, 2007
  8. Lei Lei Shi
    Replies:
    1
    Views:
    699
Loading...