Comments (3)
This is an excellent candidate for a API validation test. #10
from rison.
I'm running into this as well. Any plans for a fix as of yet?
from rison.
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)
- Add license HOT 3
- API testing
- bower project HOT 4
- Put on readthedocs.org
- The 0.1.1 version on npm is not the same as v0.1.1 on GitHub HOT 4
- Stack overflow
- Version 0.1.2 is not on npm HOT 2
- Encoding issue with object's key starting with a digit
- v0.1.3 needs tagging HOT 1
- Spaces do not roundtrip with encode_uri
- There is no git tags on GitHub repository
- Maintained fork
- Main URL dead HOT 3
- [] for arrays rather than !() HOT 1
- Error encoding sparse array HOT 3
- version 0.1.3 is not on npm (did this ever publish to npm ?, is this a dead repo?) HOT 1
- Gulp/grunt automated testing, coverage, lint, etc.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rison.