iOS Question HttpUtils download error

MikeH

Well-Known Member
Licensed User
Longtime User
Not sure if this is a bug or, more likely, my lack of understanding.

Using the https://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":

B4X:
'Returns the response as a string.
Public Sub GetString2(Encoding As String) As 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.
 

sorex

Expert
Licensed User
Longtime 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.

B4X:
        Select Job.JobName
            Case "Job1"
                Log(Job.GetString) 'fails
                Log(Job.GetString2("Windows-1252")) 'works
        End Select
 
Upvote 0
Top