0
  1. I am reading XML file through Jdom and save into DataModel list.
  2. then display that list in outputText and get in controller that time print correctly.
  3. problem is when I am going to display that list in inputText and get in controller that time it converts special character into junk character
  4. Example

    If in my xml ΔLMN and ΔXYZ text like this then when I am going to save and get from Model n prints on page that time it prints same..but when I am opening that list in inputText and save into Model and prints into console that time it prints \u0394LMN and \u0394XYZ

I am not getting how to solve this problem in java?

Someone told me JDOM have problem in parsing and saving string value, so now I am working on jaxb. But please help me where I'm going wrong.

In jsf page question is my controller .

<h:outputText id="correctAns" value="#{question.questionModel.correctAnswer}" />  

when I am going to print this I got same.

But when i am save from inputext i got junk character when i am going to print in my controller. In my jsp page i have add <%@ page pageEncoding="UTF-8" %>

<h:outputText id="correctAns" value="#{question.questionModel.correctAnswer}" />
rolfl
  • 17,539
  • 7
  • 42
  • 76
vijayk
  • 2,633
  • 14
  • 38
  • 59
  • It is almost certian that JDOM is doing things just right, and that the code you use to **output** from JDOM is not setting the CharSet of the OutputStream, and the XMLOutputter. As a consequence, JDOM will assume the worst, and escape all non-ASCII characters. Please show us the code you use to get the data out of the JDOM model. – rolfl Jan 03 '14 at 15:22
  • http://stackoverflow.com/questions/20944874/how-to-get-proper-special-character-from-string-in-java – vijayk Jan 06 '14 at 07:14

0 Answers0