File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,8 @@ var assign = function assignSingleSource(target, source) {
110110var decode = function ( str , decoder , charset ) {
111111 var strWithoutPlus = str . replace ( / \+ / g, ' ' ) ;
112112 if ( charset === 'iso-8859-1' ) {
113- return unescape ( strWithoutPlus ) ; // Cannot throw
113+ // unescape never throws, no try...catch needed:
114+ return strWithoutPlus . replace ( / % [ 0 - 9 a - f ] { 2 } / gi, unescape ) ;
114115 }
115116 // utf-8
116117 try {
Original file line number Diff line number Diff line change @@ -627,5 +627,10 @@ test('parse()', function (t) {
627627 st . end ( ) ;
628628 } ) ;
629629
630+ t . test ( 'does not interpret %uXXXX syntax in iso-8859-1 mode' , function ( st ) {
631+ st . deepEqual ( qs . parse ( '%u263A=%u263A' , { charset : 'iso-8859-1' } ) , { '%u263A' : '%u263A' } ) ;
632+ st . end ( ) ;
633+ } ) ;
634+
630635 t . end ( ) ;
631636} ) ;
You can’t perform that action at this time.
0 commit comments