Solved

Trying to display text with single quotes

Posted on 2003-11-03
5
285 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

724 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