Question: When I try to display German text e.g., Zurücksetzen on a JSP through `request.setAttribute()`, it comes out as `Zur�cksetzen`.

```
request.setAttribute("test", "Zurücksetzen");

```

My JSP page defines contentType as UTF-8:

```
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

```

and I am displaying the attribute simply with `${test}`.

---

The text is displayed correctly if I forward the request to the JSP page instead of include the JSP 

Forward (working):   

`request.getRequestDispatcher("/WEB-INF/views/index.jsp").forward(request, response);`

Include (not working):   

`request.getRequestDispatcher("/WEB-INF/views/index.jsp").include(request, response);`

---

My IDE is using UTF-8

[![enter image description here](https://i.stack.imgur.com/mAa9D.png)](https://i.stack.imgur.com/mAa9D.png)

Answer: 
Set the encoding of the ServletResponse:

```
response.setCharacterEncoding("UTF-8");

```
As explained [here](https://stackoverflow.com/questions/5928046/spring-mvc-utf-8-encoding) with Spring, the best way is to set the response to UTF-8 globally inside the web.xml using the Spring filter CharacterEncodingFilter :

```
<filter>  
    <filter-name>encodingFilter</filter-name>  
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  
    <init-param>  
       <param-name>encoding</param-name>  
       <param-value>UTF-8</param-value>  
    </init-param>  
    <init-param>  
       <param-name>forceEncoding</param-name>  
       <param-value>true</param-value>  
    </init-param>  
</filter>  
<filter-mapping>  
    <filter-name>encodingFilter</filter-name>  
    <url-pattern>/*</url-pattern>  
</filter-mapping>

```