Android Question File.ReadString encoding

xunwichtig

Member
Licensed User
Hi,

what kind of encoding is the retuned string of file.readstring?

and, its posible to fill copy the content of a file into a string without a reencoding so that the string contains the native filecontent?

Or its posible to access the memory of the string nativ like a pointer operation?


JimJim
XUN
 

Erel

Administrator
Staff member
Licensed User
File.ReadString assumes that the string is UTF 8 encoded.

You can read any file you like to an array of bytes:
B4X:
Dim data() As Byte = Bit.InputStreamToBytes(File.OpenInput(...))
 

xunwichtig

Member
Licensed User
hi,

i know, but i need it as a unencoded string.

btw... i don't understand how and why the string contains not the native filedata. The string-encode needs regular only for displaying the content, and not for accessing the bytes in it.
So, when i read the file into a string and send it over the network, then i receive not the raw stuff. I'm shure, that this way is a wrong way to handel the data inside a string.


JimJim
XUN
 

Erel

Administrator
Staff member
Licensed User
The conversion from bytes to a string of characters depends on the encoder.

There is no such thing as unencoded string (assuming that the file stores text).
 
Top