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: 
Answering my own question:

As set out in [JSP Globalization Support](https://docs.oracle.com/cd/B14099_19/web.1012/b14014/jspnls.htm), the defaults are as follows

```
The default MIME type is text/html for traditional JSP pages; it is text/xml for JSP XML documents.

The default for the page source character encoding (for translation) is ISO-8859-1 (also known as Latin-1) for traditional JSP pages; it is UTF-8 or UTF-16 for JSP XML documents.

The default for the response character encoding is ISO-8859-1 for traditional JSP pages; it is UTF-8 or UTF-16 for JSP XML documents.

The determination of UTF-8 versus UTF-16 is according to "Autodetection of Character Encodings" in the XML specification, at the following location

```

So the `Servlet` and `JSP` pages are by default `ISO-8859-1`.

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

When you **`.include`** a JSP page, as above, the page is encoded using the default character encoding (ISO-8859-1). In order to use UTF-8 encoding, you have to set `response.setCharacterEncoding("UTF-8");` Note: the ContentType directive in the JSP is ignored.

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

When you **`.forward`** to a JSP page, as above, or directly access a JSP page from the browser, the page is encoded using the default character encoding (ISO-8859-1). In order to use UTF-8 encoding, you have to add as the first line of the JSP page `<%@ page contentType="text/html; charset=UTF-8" %>`
Set the encoding of the ServletResponse:

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

```