Solved

Trying to display text with single quotes

Posted on 2003-11-03
5
266 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
A procedure for exporting installed hotfix details of remote computers using powershell
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now