mathiasbynens / jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.
https://mths.be/jsesc
MIT License
716 stars 53 forks source link

jsesc reduces consecutive percent signs to a single percent sign #22

Closed PeterEPrice closed 9 years ago

PeterEPrice commented 9 years ago

When jsesc operates on a string with two percent signs in a row ("%%") it will reduce the output to a single percent sing ("%").

Examples: jsesc test%%test -> test%test jsesc ♥%𝌆%%𝌆 -> \u2665%\uD834\uDF06%\uD834\uDF06 jsesc %%%test -> %%test jsesc test%%%% -> test%% jsesc %%%% -> %%

michaelficarra commented 9 years ago

That would be really odd. Are you sure? https://mothereff.in/js-escapes#1%25%25%25%25

mathiasbynens commented 9 years ago

I cannot reproduce this.

> jsesc('test%%test');
< 'test%%test'
PeterEPrice commented 9 years ago

I am performing the jsesc command from the terminal which makes me think it was the shell, not jsesc that is causing consecutive percent signs to turn into one percent sign. Sorry for questioning your program!