iOS Question HttpUtils download error

Discussion in 'iOS Questions' started by MikeH, Jan 23, 2015.

  1. MikeH

    MikeH Well-Known Member Licensed User

    Not sure if this is a bug or, more likely, my lack of understanding.

    Using the http://www.b4x.com/android/forum/threads/class-httputils2.46565/ modules and then trying to download a file with e.g: job1.download(urltofile) I get "Error decoding data as string."

    It seems the code is trying to read the file as a string when it should only be downloading it.

    The error is generated in module "httpjob":

    Code:
    'Returns the response as a string.
    Public Sub GetString2(Encoding As StringAs String

    Return res.GetString2(Encoding)
       
    End Sub
    I`ve worked around it by putting the Return res... in a Try/Catch block and that enabled the file to download successfully.


    As I say, it`s most likely my lack of understanding but hopefully someone can explain what went wrong.

    Thank you,
    Mike.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum as this is most likely not a bug.

    Can you post your JobDone code?
     
  3. sorex

    sorex Expert Licensed User

    old thread but I have the same issue when using the standard getstring. the windows based encoding as in the original example works fine tho.

    Code:
    Select Job.JobName
                
    Case "Job1"
                    
    Log(Job.GetString) 'fails
                    Log(Job.GetString2("Windows-1252")) 'works
            End Select
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    This means that the string is not a valid utf8 string.
     
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