Android Question convert text from one character encoding to another

hanyelmehy

Active Member
Licensed User
Longtime User
B4X:
Dim str_enc_1 As String = "some text"
Dim b() as Byte = str_enc_1.getbytes("iso-8859-1")
Dim str_enc_2 As String = BytesToString( b, 0, b.Length, "UTF-8" )
Thank you for your help ,but the problem for me what is the raw encoder used ?
for example i want to convert Arabic text (written in B4A Ide) to ISO-8859-6 encoding
Main Task is to print on POS Printer with ESC/POS ,i use correct code page for printer for Arabic but its not print correctly
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
the strings in the ide are encoded in utf-8 per default.
just switch the code from @Brandsum.
get the utf8 bytes and then convert the bytes to string using iso-8859-6
 
Upvote 0
Top