-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Special Character being displayed as question mark
PostPosted: Tue Jun 02, 2009 10:39 am 
Newbie

Joined: Tue Jun 02, 2009 10:17 am
Posts: 2
Hello,

I have an Oracle 9.2 dabatase and a CLOB field containing special characters, for example in the word "Zürich".
I checked directly on the database and I could see it perfectly being displayed there, but after doing a search using Hibernate the special character is being displayed as question mark, as "Z?rich".

This is the way I am getting the value:

public static AuditAttachment getAttachment(long id) {
AuditAttachment result = null;

Session session = null;
try {
session = getSessionFactory().openSession(); // use with JTA session context class
result = (AuditAttachment)session.get(AuditAttachment.class, id);
result.setAttachmentType("text/xml; charset=UTF-8");
} catch (HibernateException he) {
throw he;
} finally {
if (session != null) session.close();
}
return result;
}


And this is the way I am calling the previous function:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try {
response.setContentType("text/xml; charset=UTF-8");
long attachmentId = Long.parseLong(request.getParameter("id"));

AuditAttachment aa = AuditDataHelper.getAttachment(attachmentId);

response.setHeader("Pragma", "no-cache");
PrintWriter pw = new PrintWriter(response.getOutputStream(),true);

String clob = aa.getAttachmentBody().getSubString(1, (int)aa.getAttachmentBody().length());
pw.print(clob);
pw.close();
}

Somehow the string clob is containing "?" instead of "ü".

Does anyone have a hint about it?

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.