MikeH Well-Known Member Licensed User Longtime User Jan 23, 2015 #1 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": Code: Copy '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.
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": Code: Copy '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.
Erel B4X founder Staff member Licensed User Longtime User Jan 24, 2015 #2 Moved to the questions forum as this is most likely not a bug. Can you post your JobDone code? Upvote 0
S sorex Expert Licensed User Longtime User Mar 30, 2016 #3 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: Copy Select Job.JobName Case "Job1" Log(Job.GetString) 'fails Log(Job.GetString2("Windows-1252")) 'works End Select Upvote 0
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: Copy Select Job.JobName Case "Job1" Log(Job.GetString) 'fails Log(Job.GetString2("Windows-1252")) 'works End Select
Erel B4X founder Staff member Licensed User Longtime User Mar 31, 2016 #4 This means that the string is not a valid utf8 string. Upvote 0