]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/uwobo/src/ocaml/uwobo_logger.ml
- bugfix use Netconding.Url.encode instead of trivial home made encoding
[helm.git] / helm / uwobo / src / ocaml / uwobo_logger.ml
index 0a27ee2643bd036afd7e55235d0784f0092db783..c2f69eecc80213b415b572450854d297c9c9e472 100644 (file)
@@ -68,13 +68,7 @@ class sysLogger ?(level: priority = `Notice) () =
 
   (** non thread safe, a processingLogger is usually instantied locally for each
   thread *)
-class processingLogger =
-  let html_escape s = (* TODO too naive, use Nethtml.encode instead *)
-    Pcre.replace ~pat:"<" ~templ:"&lt;"
-      (Pcre.replace ~pat:">" ~templ:"&gt;"
-        (Pcre.replace ~pat:"&" ~templ:"&amp;" s))
-  in
-  fun () ->
+class processingLogger () =
   object
     val mutable log_lines: string list = []
     method log msg = log_lines <- msg :: log_lines
@@ -84,6 +78,6 @@ class processingLogger =
         "<html><body>\n%s\n</body></html>"
         (String.concat
           "<br />\n"
-          (List.map html_escape (List.rev log_lines)))
+          (List.map (Netencoding.Url.encode ~plus:false) (List.rev log_lines)))
   end