This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes How to Set Character Encodeing in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to Set Character Encodeing in JSP" Watch "How to Set Character Encodeing in JSP" New topic
Author

How to Set Character Encodeing in JSP

ramakrishna rayudu
Ranch Hand

Joined: Mar 08, 2011
Posts: 57
Hi..

i have JSP like This Can you help me how to set the character encodeing.


<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile12.dtd" >
<%@taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>


<html:html locale="true" >
<head>
<meta name="keywords" content="HTML,CSS,XML,JavaScript" />
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title><bean:message key="headertitle.text"/></title>
<link rel="stylesheet"
href="<%=request.getContextPath()%>/css/style.css"></link>
<script src="scripts/helpcontent.js"></script>

i am useing the <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
but i am unable to set the encodeing type to UTF-8
again i need to go to Browser Settings and i need to select the Encodeing Type.
is there any way that i need to set the browser character encoding to UTF_8 when the page is loding???

Example i have seen is google Home Page.when the Google Home Page Loding it will Automtically setting Browser the character Encoding tom UTF-8



Thanks,
Ramakrishna rayudu.




















sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

You can use the contentType attribute of the page directive to set the charset for the response.


[Servlet tutorial] [Servlet 3.0 Cook Book]
ramakrishna rayudu
Ranch Hand

Joined: Mar 08, 2011
Posts: 57
i have used the Page Directive Tag all so but no use.
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Have you tried this.

ramakrishna rayudu
Ranch Hand

Joined: Mar 08, 2011
Posts: 57
yes.i have all so tried that.but i need to do the same think.i need to go to the Browser i and need to set the Character first
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

What charset are you trying to display? I mean which language the response is in.
ramakrishna rayudu
Ranch Hand

Joined: Mar 08, 2011
Posts: 57
it is wokring for all but not for Hindi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Set Character Encodeing in JSP