Android Question File.ReadString encoding

Discussion in 'Android Questions' started by xunwichtig, Feb 10, 2015.

  1. xunwichtig

    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
     
  2. Erel

    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:
    Code:
    Dim data() As Byte = Bit.InputStreamToBytes(File.OpenInput(...))
     
  3. xunwichtig

    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
     
  4. Erel

    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).
     
    thedesolatesoul and NJDude like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice