Results 1 to 6 of 6

Thread: How to convert non null-terminated byte array to Unicode string?

  1. #1
    Member
    Join Date
    Jan 10
    Posts
    52

    How to convert non null-terminated byte array to Unicode string?

    Hello,
    not sure if terminology is right, but here is what I want:
    1.1. Text:
    Code:
    C:\ABCD-汉语漢語-йцукен-πρσ
    1.2. String:
    Code:
    "C:\ABCD-" & ChrW$(&H6C49) & ChrW$(&H8BED) & ChrW$(&H6F22) & ChrW$(&H8A9E) & "-" & ChrW$(&H439) & ChrW$(&H446) & ChrW$(&H443) & ChrW$(&H43A) & ChrW$(&H435) & ChrW$(&H43D) & "-" & ChrW$(&H3C0) & ChrW$(&H3C1) & ChrW$(&H3C3)
    1.3. Array of Bytes (2 bytes, UTF16):
    Code:
    067 000 058 000 092 000 065 000 066 000 067 000 068 000 045 000 073 108 237 139 034 111 158 138 045 000 057 004 070 004 067 004 058 004 053 004 061 004 045 000 192 003 193 003 195 003 013 000
    -------------------------------------------------------------------------------------------------------------------

    2.1*. Text (supposed to be the same as in 1.1):
    Code:
    C:\ABCD-걉čΖ*ęΌ’čŖ˛-ŠΉŃ†ŃƒŠŗŠ΅Š½-Ļ€ĻĻƒ
    2.2*. Array of Bytes (maybe UFT8):
    Code:
    067 058 092 065 066 067 068 045 230 177 137 232 175 173 230 188 162 232 170 158 045 208 185 209 134 209 131 208 186 208 181 208 189 045 207 128 207 129 207 131
    I need a solution to get from (2.2) to (1.1).
    Notice that Latin characters in (2.2) are encoded by 1 byte, and non-Latin by 2 bytes.
    Last edited by riov; Jul 22nd, 2012 at 08:42 PM.

  2. #2
    Member
    Join Date
    Jan 10
    Posts
    52

    Re: How to convert non null-terminated byte array to Unicode string?

    Please move this thread to "Visual Basic 6 and Earlier".

  3. #3
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: How to convert non null-terminated byte array to Unicode string?

    Are you doing this in VB6 or VBA?

    is it in continuation to this thread?
    Last edited by koolsid; Jul 22nd, 2012 at 10:13 PM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  4. #4
    Member
    Join Date
    Jan 10
    Posts
    52

    Re: How to convert non null-terminated byte array to Unicode string?

    Yes, maybe you are right - we can call it a continuation to that thread.

  5. #5
    Member
    Join Date
    Jan 10
    Posts
    52

    Re: How to convert non null-terminated byte array to Unicode string?

    You can delete this thread.

  6. #6
    Moderator
    Join Date
    Jan 05
    Location
    Sydney
    Posts
    13,615

    Re: How to convert non null-terminated byte array to Unicode string?

    Thread closed. Please refer answers to this thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •