Dim txtAsBytes() As Byte = TXTLIST.Text.GetBytes("UTF8")
Dim bb As B4XBytesBuilder
bb.Initialize
For Each b As Byte In txtAsBytes
'If we see a LF line feed
If b = 0x0A Then
'add a CR to the LF to get a CRLF
bb.Append(Array As Byte(0x0D))
bb.Append(Array As Byte(0x0A))
Else
'all the other bytes, just copy them
bb.Append(Array As Byte(b))
End If
Next[/S]
'Write the bytes to file.
File.WriteBytes("",SelectedPad,bb.ToArray)