Commit 15c637e876315c13d938a2e2ee9ba8a349bdfd11

Thomas de Grivel 2019-02-21T10:11:20

fix form submission with UTF-8 characters

diff --git a/thot.lisp b/thot.lisp
index 88440de..5f4a380 100644
--- a/thot.lisp
+++ b/thot.lisp
@@ -273,12 +273,16 @@
                  (request-handler request reply)))
            (data (char)
                  (stream-write buffer char)
-                 (cond ((= 0 (decf length))
-                        (setf (request-data% request) (get-buffer))
-                        (request-handler request reply))
-                       (t
-                        (data)))))
-        #'method))))
+                 (let* ((char-string (make-string
+                                      1 :initial-element char))
+                        (char-length (trivial-utf-8:utf-8-byte-length
+                                      char-string)))
+                   (cond ((= 0 (decf length char-length))
+                          (setf (request-data% request) (get-buffer))
+                          (request-handler request reply))
+                         (t
+                          (data))))))
+           #'method))))
 
 ;;  Reply