Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Trying to display text with single quotes

Posted on 2003-11-03
5
Medium Priority
?
294 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Sometimes Administrators rights are not enough. These cases call for the SYSTEM account. The process in this article outlines the steps required to execute commands using the SYSTEM account.
What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 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