Bug? HTTP Utils GetString issue

Discussion in 'iOS Bugs & Wishlist' started by qsrtech, May 18, 2015.

  1. qsrtech

    qsrtech Active Member Licensed User

    Using pretty much the same code in b4a but some of my http (html) results are throwing an error in b4i/ipad

    Here is the error msg, hopefully something can be made from it to determine how to resolve. I did test directly loading into the webview the links that failed using httpjob.download2 and they seem to work without any issue. Again this works flawlessly in b4a's httpjob.download2. I actually even tried to replace the spaces in the link with "%20" and it returns no data at all.

    Error occurred on line: 100 (httpjob)
    Error decoding data as string.
    Stack Trace: (
    CoreFoundation <redacted> + 150
    libobjc.A.dylib objc_exception_throw + 38
    CoreFoundation <redacted> + 0
    QSR Employee App -[B4ICommon BytesToString::::] + 410
    QSR Employee App -[B4IHttpResponse GetString2:] + 238
    QSR Employee App -[b4i_httpjob _getstring2::] + 268
    QSR Employee App -[b4i_httpjob _getstring:] + 234
    CoreFoundation <redacted> + 68
    CoreFoundation <redacted> + 300
    QSR Employee App +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928
    QSR Employee App -[B4IShell runMethod:] + 496
    QSR Employee App -[B4IShell raiseEventImpl:method:args::] + 1846
    QSR Employee App -[B4IShellBI raiseEvent:event:params:] + 1316
    QSR Employee App -[B4ICommon CallSub4::::] + 346
    QSR Employee App -[B4ICommon CallSub2::::] + 254
    QSR Employee App -[b4i_httpjob _complete::] + 434
    QSR Employee App -[b4i_httputils2service _completejob::::] + 752
    QSR Employee App -[b4i_httputils2service _hc_responsesuccess::] + 296
    CoreFoundation <redacted> + 68
    CoreFoundation <redacted> + 300
    QSR Employee App +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928
    QSR Employee App -[B4IShell runMethod:] + 496
    QSR Employee App -[B4IShell raiseEventImpl:method:args::] + 2060
    QSR Employee App -[B4IShellBI raiseEvent:event:params:] + 1316
    QSR Employee App __61-[B4IHttp URLSession:downloadTask:didFinishDownloadingToURL:]_block_invoke + 244
    libdispatch.dylib <redacted> + 368
    libdispatch.dylib <redacted> + 22
    libdispatch.dylib <redacted> + 1322
    CoreFoundation <redacted> + 8
    CoreFoundation <redacted> + 1512
    CoreFoundation CFRunLoopRunSpecific + 476
    CoreFoundation CFRunLoopRunInMode + 106
    GraphicsServices GSEventRunModal + 136
    UIKit UIApplicationMain + 1440
    QSR Employee App main + 116
    libdyld.dylib <redacted> + 2
    )
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the relevant code and if possible the link you are downloading?
     
  3. qsrtech

    qsrtech Active Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    This is not a bug.
    Job.GetString assumes that the string is encoded with UTF8. This is not the case here. I'm not sure which encoding is used however Windows-1252 works fine:
    Code:
    Job.GetString2("Windows-1252")
     
  5. qsrtech

    qsrtech Active Member Licensed User

    Ok, but that doesn't explain why it works fine on b4a 100%, and about 90% of the other "results" do work on b4i.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    The decoding will only fail when there is one or more "invalid" characters. Android replaces the invalid character with a question mark or some other character. iOS throws an exception in this case (which is probably better as it allows you to fix the mistake).
     
  7. qsrtech

    qsrtech Active Member Licensed User

    Ahhh. I think i understand the situation now. I recall the funny question symbol now in android. Some of the "data" uses an (R) symbol (registered trademark) which must not be utf8 compatible. I think i prefer the android solution so it doesn’t break code. Then again i prefer android over apple.

    Thanks for your help.
     
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