Setting Page Character Encoding for a JSP File

See Also

Page character encoding is the encoding in which the JSP source file is written. The JSP 2.0 specification distinguishes between two syntaxes when detecting the page character encoding:

To set the page character encoding for a file in standard JSP syntax:

For JSP files (standard syntax), the page encoding is set as follows:

  1. Create a JSP file that uses standard JSP syntax. Right-click the JSP file and choose Properties. Note that the Encoding property is set to the encoding for the project. This is the JSP file's page encoding. You cannot change the page encoding in the Properties sheet. The place where you set the page encoding depends on whether you want to set it for an individual JSP file or for a group of JSP files together. The following step guides you through the setting of the page encoding for JSP files.
  2. Do one of the following to change the JSP file's page encoding:
To set the page character encoding for a file in JSP document syntax:

For JSP documents (XML syntax), the page encoding is set as follows:

  1. Create a JSP file that uses XML syntax. Right-click the JSP document and choose Properties. Note that the Encoding property is set to the encoding for the project. This is the JSP document's page encoding. You cannot change the page encoding in the Properties sheet. For JSP documents, you can change the page character encoding in one place only:
  2. Double-click the JSP file so that it opens in the Source Editor. The default XML declaration of a JSP document created in the IDE includes an encoding attribute as follows:
      <?xml version="1.0" encoding="UTF-8"?>
    You can change the encoding in the XML declaration and save the JSP document.
See Also

Legal Notices