B4R Question Can support UTF8 function?

Erel

B4X founder
Staff member
Licensed User
Longtime User
Strings in B4R (and in Arduino) are mostly identical to arrays of bytes. There are no encoders or decoders.
This is different than other B4X tools where strings represent a set of characters.

You can use UTF8 strings in the IDE. For example:
B4X:
Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   Dim s As String = "שלום"
   Log(s)
   Log(s.Length)
End Sub
Output:

AppStart
שלום
8

The length is 8 because the 4 characters were converted to 8 bytes during compilation.
 
Upvote 0
Top