From eeaf779411ac6183dee8a8412885c868e9a65556 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sun, 17 Jun 2007 10:40:23 +0000 Subject: [PATCH] fix reading Unicode text svn: r6684 --- collects/net/cgi-unit.ss | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/collects/net/cgi-unit.ss b/collects/net/cgi-unit.ss index f754d216b3..be59135724 100644 --- a/collects/net/cgi-unit.ss +++ b/collects/net/cgi-unit.ss @@ -1,6 +1,7 @@ (module cgi-unit (lib "a-unit.ss") (require (lib "etc.ss") - "cgi-sig.ss") + "cgi-sig.ss" + "uri-codec.ss") (import) (export cgi^) @@ -34,33 +35,7 @@ ;; with all the characters converted back. (define (query-chars->string chars) - (list->string - (let loop ([chars chars]) - (if (null? chars) null - (let ([first (car chars)] - [rest (cdr chars)]) - (let-values ([(this rest) - (cond - [(char=? first #\+) - (values #\space rest)] - [(char=? first #\%) - (if (and (pair? rest) (pair? (cdr rest))) - (values - (integer->char - (or (string->number - (string (car rest) (cadr rest)) - 16) - (raise (make-invalid-%-suffix - (if (string->number - (string (car rest)) - 16) - (cadr rest) - (car rest)))))) - (cddr rest)) - (raise (make-incomplete-%-suffix rest)))] - [else - (values first rest)])]) - (cons this (loop rest)))))))) + (form-urlencoded-decode (list->string chars))) ;; string->html : string -> string ;; -- the input is raw text, the output is HTML appropriately quoted