diff --git a/src/gd_request.ml b/src/gd_request.ml
index 0fe0e2833bd3ea27c2ce64033783ca42564333b4..1d94a4639fa330838176427af59d5873cf5569d2 100644
--- a/src/gd_request.ml
+++ b/src/gd_request.ml
@@ -72,6 +72,8 @@ module Request = struct
     | Libgrew.Error msg -> Utils.error uuid msg
     | exc -> Utils.error uuid (sprintf "Unexpected error, please report [%s]" (Printexc.to_string exc))
 
+  let esc s = Str.global_replace (Str.regexp "<") "&lt;" s
+
   (* produce 10 more solutions *)
   let next uuid =
     try
@@ -91,10 +93,10 @@ module Request = struct
           let sent_with_context =
             if !context
             then
-              let prev_sent = try let (_,_,s,_) = corpus.(pos-1) in s^"</br>" with _ -> "" in
-              let next_sent = try let (_,_,s,_) = corpus.(pos+1) in s^"</br>" with _ -> "" in
-              sprintf "%s <font color=\"#FC5235\">%s</font> %s" prev_sent sent next_sent
-            else sprintf "<font color=\"#FC5235\">%s</font>" sent in
+              let prev_sent = try let (_,_,s,_) = corpus.(pos-1) in (esc s)^"</br>" with _ -> "" in
+              let next_sent = try let (_,_,s,_) = corpus.(pos+1) in "</br>"^(esc s) with _ -> "" in
+              sprintf "%s <font color=\"#FC5235\">%s</font> %s" prev_sent (esc sent) next_sent
+            else sprintf "<font color=\"#FC5235\">%s</font>" (esc sent) in
             match kind with
             | Conll -> save_dep ?domain rtl uuid filename text cl.pattern matching graph sent_with_context;
             | Pst -> save_dot ?domain uuid filename text cl.pattern matching graph sent_with_context