File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -464,6 +464,40 @@ private static bool notEncoded (char c)
464464 c == '_' ;
465465 }
466466
467+ private static void urlEncode ( byte b , Stream output )
468+ {
469+ if ( b > 31 && b < 127 ) {
470+ if ( b == 32 ) {
471+ output . WriteByte ( ( byte ) '+' ) ;
472+ return ;
473+ }
474+
475+ if ( isNumeric ( b ) ) {
476+ output . WriteByte ( b ) ;
477+ return ;
478+ }
479+
480+ if ( isAlphabet ( b ) ) {
481+ output . WriteByte ( b ) ;
482+ return ;
483+ }
484+
485+ if ( isUnreserved ( b ) ) {
486+ output . WriteByte ( b ) ;
487+ return ;
488+ }
489+ }
490+
491+ output . WriteByte ( ( byte ) '%' ) ;
492+
493+ var i = ( int ) b ;
494+ var idx = i >> 4 ;
495+ output . WriteByte ( ( byte ) _hexChars [ idx ] ) ;
496+
497+ idx = i & 0x0F ;
498+ output . WriteByte ( ( byte ) _hexChars [ idx ] ) ;
499+ }
500+
467501 private static void urlEncode ( char c , Stream result , bool unicode )
468502 {
469503 if ( c > 255 ) {
You can’t perform that action at this time.
0 commit comments