How to dynamically set charset (other than ISO-8859-1) for JavaServer Page
 Technote (FAQ)
 
Problem
In WebSphere, a JavaServer Page (JSP) written in a character set other than ISO-8859-1 must set the appropriate character set in a page directive.
 
Solution
A JSP written in a character set other than ISO-8859-1 must set the appropriate character set in a page directive. It cannot be set dynamically because the page has to be aware of the setting during translation. Dynamic settings are for runtime only.

You can use setContentType() in JSP but the setContentType() method has no effect on interpreting the text of the JSP during translation. If a particular character set is required during translation, that must be specified in a page directive.

Code example for UTF-8
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > JSP
Operating system(s): HP-UX
Software version: 4.0
Software edition:
Reference #: 1141537
IBM Group: Software Group
Modified date: Sep 15, 2004