Search code examples
javaoracle-databasejspencodingapostrophe

Apostrophes returned by sql query not being printed in Java


I'm working with Oracle SQL Developer and the queries I execute are well printed in its console, but not in the Java console either in jsp.

  • In debug mode (inspect mode or varibles schede) doesn't even appears the character, it's shown the 2 words together.
  • In the Java console appears as '?'
  • In the JSP as '[0092]'. Could it be encoding issue?

The query is a simple select:

SELECT something, somethingElse FROM myTable where filter = 'someArgument';

This is how I retrieve the value after executeQuery():

  //here is already not being printed. But the jsp shows it as unreadable character.
  resultSet.getObject(i).toString();

This is how I put it in the jsp:

stringBuffer.append("<option value='" 
+ mapEntryElement.getKey() + "'>"+ mapEntryElement.getValue().toString() + "</option>");

I've tried adding this to the JSP but nothing:

<%@ page language="java" contentType="text/html; charset=utf-8" %>

Any idea?


Solution

  • It was bad written in the database. It was an accent instead of apostrophe