Solved

Trying to display text with single quotes

Posted on 2003-11-03
5
283 Views
Last Modified: 2010-04-01
Hi,
 I have some code that displays text from an Oracle db onto a web page. When JSP writes out text with a single quote in it, it replaces it with a "$" or "?".

Do i need to use escape sequence for it?


 str = str + "<TR><TD class='TextDarkGreyMedium'>" + replaceNull(course.getString("course_description")) + "</TD></TR>";

replaceNull just checks if the value is NULL and replaces it with an empty string, soft of like NVL in ORACLE.
0
Comment
Question by:mash79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 9675685
there are number of factors. the charset encoding of the string originally stored the in Oracle. the default java app locale. and the jsp page charset encoding. you need to make sure the first two are the same and the jsp charset includes the char that you want to display.
0
 

Author Comment

by:mash79
ID: 9675754
I am not sure about the first 2. The web page was created initialy ASP (VBScript) and it worked fine, so i dont think Oracle is the problem.


This is what i have at the top of the JSP page
<%@ page language="java"  contentType="text/html;charset=WINDOWS-1252" import="java.util.*" errorPage="error.jsp"%>


Can you see anything wrong with the contentType there?
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 50 total points
ID: 9676298
how the data are populated to oracle?

I would try contentType="text/html;charset=UTF-8" or ISO-8859-1
0
 

Author Comment

by:mash79
ID: 9676330
I found the problem. It was not a real single quote, it was some sort of apostrophe, maybe pasted in from Word or something. When i changed it to a single quote it worked fine.

I will award you the points for your help though.

Do you know where they could of gotton this apostrophe from? It looks like ` but inverted?

0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9676345
>> Do you know where they could of gotton this apostrophe from? It looks like ` but inverted?
u r right, it's copy and pasted from word. using ISO-8859-1 in both all you jsp page might help.

Glad to know your problem is solved and thanks for you kind 'A' grade!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
A hard and fast method for reducing Active Directory Administrators members.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question