Git Product home page Git Product logo

Comments (4)

Kisty avatar Kisty commented on August 16, 2024

Can you make a simple repo recreating this bug? That will help the developers tackle this one

from ksoap2-android.

android-dataticket avatar android-dataticket commented on August 16, 2024

I don't have the time for that now, but I can share what I found by stepping through it.

envelope.bodyOut correctly displays the '@' sign
httpTransport.requestDump incorrectly displays the ascii code '&#64 ;'

it's happening at line 62 in HttpTransportSE.class:
byte[] requestData = this.createRequestData(envelope, "UTF-8");

when SoapEnvelope is writing to the KXmlSerializer on line 138 of Transport.class:
envelope.write(xw);

somewhere here, the XmlSerializer writer is changin the '@' to '&#64 ;' on Android 10.0 devices.

I wish I could provide more help!

from ksoap2-android.

Kisty avatar Kisty commented on August 16, 2024

Sounds like a framework issue. Have you tried searching for the bug on https://b.android.com?

from ksoap2-android.

android-dataticket avatar android-dataticket commented on August 16, 2024

hello @Kisty , I ran into this issue again, over a year later.. and instead of asking our vendor if they could change the username to remove the @ sign, I dug deeper into the KSOAP classes.

I found the issue to be the following line, in the KXmlSerializer.class, line 98, it's an IF statement that appears to work with Android 9.0 and below, but has a slightly different behavior on Android 10+

if (c < ' ' || c == '@' || c >= 127 && !this.unicode) {
            this.writer.write("&#" + c + ";");
        } else {
            this.writer.write(c);
        }

What is happening here, correct me if I'm wrong, is that if 'unicode' is true, then this entire IF statement should return false and the writer should call this.writer.write(c) instead of this.writer.write("&#" + c + ";");

However, on Android 10+, it seems that we need to encapsulate the OR's and make sure the AND section overshadows the entire IF statement.. for example, when I change this line to the following, it works as intended on Android 10+:

        if ((c < ' ' || c == '@' || c >= 127) && !this.unicode) {
            this.writer.write("&#" + c + ";");
        } else {
            this.writer.write(c);
        }

Notice I am putting an extra set of brackets over (c < ' ' || c == '@' || c >= 127) so that it will always also check for && !this.unicode..

I don't know why, but with Android 10+, it is evaluating this as if it were (c < ' ' || c == '@') || (c >= 127 && !this.unicode)

Is there any way this could be fixed in the library? I know it hasn't been changed in a while and maybe nobody else runs into this because nobody else is trying to pass an @ sign in a header item string...

I hope it was easy enough to follow, let me know if I can help any...

from ksoap2-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.