Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Q: charset problem using Java?

Q: charset problem using Java?

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 17 Apr 2002 21:54:48 -0800
Message-ID: <3cbe5198@news.victoria.tc.ca>


Hello

My problem is that apostrophe characters (') in my data from an oracle database are being returned as question mark characters (?) in output generated by a JSP. (The source text of the HTML, not just what it looks like in the browser).

I assume this has something to do with language or codepage or charset settings, but I haven't a clue where to start looking to solve this. Suggestions appreciated.

In SQLPlus the data looks like (e.g.) " Frank's Tools " (note the ' ). But in the HTML source it looks like " Frank?s Tools ".

the JSP has the following steps (Some of this code is in another class, but I assume that's not relevant).

	<%
	Statement st;   // allocated by createStatement(), not shown
	String sql = "SELECT FOO FROM THE_TABLE";
	ResultSet rows = st.executeQuery(sql) ;

	while (rows.next())
	{
		String foo = rows.getString("FOO");

%>
This part of the text is the literal HTML. The string foo gets embedded next. <%= foo %> now return to the code portion <% } // end while
%>

As I said, the string gets embedded in the HTML, but it has a ? instead of a ' character.

Either the database is returning a ? in the data, or the getString() method is converting it to a ?, or the <%= %> is converting it to a ?, (hard to imagine that anything later could do it). Its hard to even decide where the problem occurs since if I print the intermediate results then I am using the same logic, so I still don't know for sure when the conversion happens.

So where/what in the above do I alter so that the apostrophes in the data turn up as apostrophes in the source of the HTML?

Thanks for any feedback
malcolm dew-jones Received on Thu Apr 18 2002 - 00:54:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US