Specify the correct content type and character set

To send characters from a JSP file to a web browser, you must use the correct encoding. Always specify the content type and character set. You can use different lines in a JSP page to set the content type and character set:
  • <%@ page contentType="text/html; charset=type" %> lets the browser know how the returned HTML page is encoded. UTF-8 is the recommended standard character set if it is available for your target client browser. For more information, consult the Release Notes or the vendor for your target client browser.
  • You can use a meta tag such as <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=type"> for the same purpose, but be aware that the manner in which meta tags are interpreted by different browsers is not standard.

Note: If UTF-8 is supported by your target client browser, it is important to consistently use the UTF-8 character set as it functions properly on UNIX-style operating systems and does not have the same problems associated with other character sets.