diff --git a/surf/spring-surf/spring-surf/pom.xml b/surf/spring-surf/spring-surf/pom.xml
index ccb4e66f..8a046969 100644
--- a/surf/spring-surf/spring-surf/pom.xml
+++ b/surf/spring-surf/spring-surf/pom.xml
@@ -94,5 +94,10 @@
maven-artifact
3.0.3
+
+ org.owasp.encoder
+ encoder
+ 1.2.3
+
diff --git a/surf/spring-surf/spring-surf/src/main/java/org/springframework/extensions/surf/mvc/GeneratorController.java b/surf/spring-surf/spring-surf/src/main/java/org/springframework/extensions/surf/mvc/GeneratorController.java
index 4f8e0224..d29005d4 100644
--- a/surf/spring-surf/spring-surf/src/main/java/org/springframework/extensions/surf/mvc/GeneratorController.java
+++ b/surf/spring-surf/spring-surf/src/main/java/org/springframework/extensions/surf/mvc/GeneratorController.java
@@ -32,6 +32,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.owasp.encoder.Encode;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
@@ -159,7 +160,7 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
try
{
- response.getOutputStream().write(baos.toByteArray());
+ response.getOutputStream().write(Encode.forJava(baos.toString()).getBytes());
}
catch (IOException e)
{