0

I am getting an array of bytes by using of the below code:

Open filename_ For Binary Access Read As #fileInt
If LOF(fileInt) > 0 Then
    ReDim byteArr(0 To LOF(fileInt) - 1)
    Get #fileInt, , byteArr
    byteArrSize = LOF(fileInt)
    Close #fileInt
    ReadFileAsBinary = byteArr
End If

So, I have an array of bytes (byteArr)

How can I convert the array of bytes into astring in VBA knowing that the initial [text] file has [for example] UTF8 char set ?

Is there any elegant solution in VBA like:

Python

str = bytes.decode("utf_8") 

or

Java

str = String(bytes, StandardCharsets.UTF_8);

?

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
newman
  • 149
  • 10

0 Answers0