Results 1 to 6 of 6

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

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2010
    Posts
    118

    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

    Thread Starter
    Lively Member
    Join Date
    Jan 2010
    Posts
    118

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

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

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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 Siddharth Rout; 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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2010
    Posts
    118

    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

    Thread Starter
    Lively Member
    Join Date
    Jan 2010
    Posts
    118

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

    You can delete this thread.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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
  •  



Click Here to Expand Forum to Full Width