Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2008, 01:01 AM
Authorized User
 
Join Date: Sep 2008
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default string change in jsp

hi,

i have a String S="hell(“two”)";

two is not surrounded with double quotes its with “two”.
i have set this string in request


request.setAttribute("Description",S);


from my jsp i called i tried to print S

<% out.print(request.getAttribute("Description")); %>


it should print me hell(“two”)

but its printing

hell(?two?)

two is surrounded with ?


pls sort my problem out

Raj

 
Old October 16th, 2008, 02:17 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Nothing to do with JSP, per se. It's a browser issue. You just need to be sure that the web page is using an encoding that supports those "curly quotes".

The good news: Even though this is a browser issue, you *CAN* use JSP to change the page encoding, but you'll need to figure out what the right encoding is, first.

What character encoding are you currently using? Do you have either
<%@page contentType="text/xml; charset=UTF-8"%>
or
request.setCharacterEncoding("UTF-8");
in your page? Or some other charset/characterEncoding???

Try UTF-8, if you aren't using it already, and see if that works with your browser.
 
Old October 16th, 2008, 10:18 PM
Authorized User
 
Join Date: Sep 2008
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for the reply,
when i use
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java"%>

i am getting the output correctly
but i am passing the string hell(“two”) in the query string
but my query string is taking hell(â#128;#156;twoâ#128;)

what may be the solution for this

Raj..

 
Old October 16th, 2008, 10:41 PM
Authorized User
 
Join Date: Sep 2008
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default

mistake in my last reply
the query string is taking correctly
but in my java class
when i use this way
String s = request.getParameter(...);
my s conatins
â??twoâ??

how to handle this issue


 
Old October 17th, 2008, 03:26 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Don't know what to tell you. A very similar JSP page works just fine, for me. Yes, using UTF-8.
 
Old October 19th, 2008, 08:25 PM
Authorized User
 
Join Date: Sep 2008
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default

hi,

i mean to say that when displaying to user i can see it correctly ,but

For translation of inputs coming back from the browser i am facing the problem .


 
Old October 19th, 2008, 09:24 PM
Authorized User
 
Join Date: Sep 2008
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default

hi
i have used this article for solving the problem but i am still facing the same issue

http://wiki.apache.org/tomcat/Tomcat/UTF-8

i have configured everything as mentioned in the article
can you suggest what might be the issue

1) configured web.xml
2) i have set the jsp header
3) written the filter class

regards
raj







Similar Threads
Thread Thread Starter Forum Replies Last Post
change the directory of uploaded files : jsp code Janoo JSP Basics 2 May 19th, 2007 06:06 AM
Please Help. mr_newreq.jsp:78: jsp:useBean can't f batken JSP Basics 0 February 22nd, 2006 09:56 PM
Change in connection string x_ray Classic ASP Basics 2 February 21st, 2006 05:10 PM
change element by string pravind XSLT 1 February 13th, 2006 09:00 AM
JSP string find characters ndanger J2EE 2 November 24th, 2004 09:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.