# File Encoding

The character encoding in XML, (X)HTML files, and JSP files can be specified and invoked in many different ways; however, we recommend that you specify the encoding in each one of your source files, for that is where many XML, HTML, JSP editors expect to find the encoding.

For example, for JSP files, you might use the pageEncoding attribute and/or the contentType attribute in the page directive, as shown in the following example:

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>

For XML files, you might use the encoding pseudo-attribute in the xml declaration at the start of a document or the text declaration at the start of an entity, as in the following example:

    <?xml version="1.0" encoding="iso-8859-1" ?>

For (X)HTML files, you might use the <meta> tag inside the <head> tags, as shown in the following example:

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />