Solved

Trying to display text with single quotes

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
constuctor calling other constructor 2 78
servlet init param and contect param 3 66
servlet concurrency 13 110
servlet example 17 51
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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