Giter Site home page Giter Site logo

Comments (3)

Nanonid avatar Nanonid commented on July 26, 2024

This is an excellent candidate for a API validation test. #10

from rison.

funseiki avatar funseiki commented on July 26, 2024

I'm running into this as well. Any plans for a fix as of yet?

from rison.

5thHorsem4n avatar 5thHorsem4n commented on July 26, 2024

I found a work around for this issue.
Instead of encodeURIComponent the entire string just encode &. The browser in my case is taking care of the rest.

In my testing it was limited to if there was another property after the string.

Here are my tests:

 var encodeUriText = {
        name: encodeURIComponent(".Black & White"),
        z:1
    };

    var currentWorkAround = {
        name: ".Black & White".replace("&","%26"),
        z:1
    };

    var encodeUriTextExpected = "(name:'.Black%20%26%20White',z:1)";
    var currentEncodeUriTextEncoding = "(name:.Black%20%26%20White,z:1))";

    it('current behavior', function () {


        //Act
        var testObjEncoded = rison.encode(encodeUriText);

        //Assert
        expect(testObjEncoded).to.deep.equal(encodeUriTextExpected);
        expect(testObjEncoded).to.deep.equal(currentEncodeUriTextEncoding);

    });

    it('current work around', function () {


        //Act
        var currentWorkAroundEncoded = rison.encode(currentWorkAround);

        //Assert
        expect(currentWorkAroundEncoded).to.deep.equal("(name:'.Black %26 White',z:1)");

    });

    it('decoding encodeUriTextExpected', function () {


        //Act
        var decoded = rison.decode(encodeUriTextExpected);

        //Assert
        expect(decoded).to.deep.equal(encodeUriText);

    });


    it('current error while decoding string', function () {


        //Act
        var decoded = rison.decode(currentEncodeUriTextEncoding);

        //Assert
        expect(decoded).to.deep.equal(encodeUriText);

    });
    it('seems to work fine', function () {


        //Act
        var decoded = rison.decode("(name:'.Black%20%26%20White')");

        //Assert
        expect(decoded).to.deep.equal({name:'.Black%20%26%20White'});

    });`

from rison.

Related Issues (18)

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.