[racket] escaping binary data in url

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Fri Aug 12 13:38:12 EDT 2011

The library already does some URL encoding for you, as "%" is an
illegal character in a query string, since that's the escape character
itself for arbitrary bytes,  "%25" gets translated down to...

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (integer->char (string->number "25" 16))
#\%
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

... that percent sign.


Would using base64-encode (from the net/base64 library) work for you?
You can take your bytes and feed them through base64-encode; the
result should be something that can be a part of URLs.


Posted on the users mailing list.