Results 1 to 6 of 6

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

Threaded View

  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.

Posting Permissions

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