<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>I am using JDOM Beta 8 version for XML parsing. we 
are happening to have lot of special characters (like registered marks, 
copyright symbols, trade marks, and other many funky chars). After building the 
document, the parser is converting the characters into "?" characters. This is 
what I am doing to build the document:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>****************************************************************************************</FONT></DIV>
<DIV><FONT size=2>
<P></FONT><FONT color=#3f7f5f size=2>// Method to return a Document object given 
an xml&nbsp;String</P></FONT><FONT size=2>
<P></FONT><B><FONT color=#7f0055 size=2>public</B></FONT><FONT size=2> Document 
getDocumentfromString(String xmlString)</P>
<P></FONT><B><FONT color=#7f0055 size=2>throws</B></FONT><FONT size=2> Exception 
{</P>
<P>Document schemaDoc = </FONT><B><FONT color=#7f0055 
size=2>null</B></FONT><FONT size=2>;</P>
<P>SAXBuilder builder = </FONT><B><FONT color=#7f0055 size=2>new</B></FONT><FONT 
size=2> SAXBuilder(</FONT><B><FONT color=#7f0055 size=2>false</B></FONT><FONT 
size=2>);</P>
<P>String resultingXML = </FONT><B><FONT color=#7f0055 
size=2>null</B></FONT><FONT size=2>;</P>
<P></FONT><B><FONT color=#7f0055 size=2>if</B></FONT><FONT 
size=2>(!StringUtils.isEmpty(xmlString)){</P>
<P></P>
<P></FONT><B><FONT color=#7f0055 size=2>try</B></FONT><FONT size=2>{</P>
<P>schemaDoc =</P>
<P>builder.build(</P>
<P></FONT><B><FONT color=#7f0055 size=2>new</B></FONT><FONT size=2> 
StringReader(xmlString));</P>
<P>}</FONT><B><FONT color=#7f0055 size=2>catch</B></FONT><FONT 
size=2>(JDOMException jdomex){</P>
<P></FONT><B><FONT color=#7f0055 size=2>throw</B></FONT><FONT size=2> 
</FONT><B><FONT color=#7f0055 size=2>new</B></FONT><FONT size=2> 
Exception(</FONT><FONT color=#2a00ff size=2>"Document could not be built: 
"</FONT><FONT size=2> + jdomex);</P>
<P>}</FONT><FONT color=#3f7f5f size=2></P></FONT><FONT size=2>
<P>}</FONT><B><FONT color=#7f0055 size=2>else</B></FONT><FONT size=2>{</P>
<P>log.info(</FONT><FONT color=#2a00ff size=2>"xmlString is null"</FONT><FONT 
size=2>);</P>
<P>}</P>
<P></FONT><B><FONT color=#7f0055 size=2>return</B></FONT><FONT size=2> 
schemaDoc;</FONT></P>
<P><FONT size=2>}</FONT></P>
<P><FONT 
size=2>********************************************************************************</FONT></P>
<P><FONT face=Arial size=2>It is working fine on Windows (2000) machine, but 
spitting "?" symbols in place of special chars on UNIX machines.</FONT></P>
<P><FONT face=Arial size=2>I used to use <FONT face=Courier 
color=#ff0000>schemaDoc = builder.build(new 
java.io.ByteArrayInputStream(xmlString.getBytes()));</FONT></FONT></P>
<P><FONT face=Arial size=2>to build the document in place of StringReader, but 
it was changing the encoding and throwing exception saying the 
special</FONT></P>
<P><FONT face=Arial size=2>chars don't belong to UTF-8. So, i changed it to 
StringReader - which doesn't throw exceptions but, converts the special chars to 
"?".</FONT></P>
<P><FONT face=Arial size=2>I also tried using <FONT face=Courier 
color=#ff0000>builder.build(new 
java.io.ByteArrayInputStream(xmlString.getBytes(</P>
<P>"UTF-8"</P>
<P>)));</FONT></FONT></P>
<P><FONT face=Arial size=2>. But that din't help too.</FONT></P>
<P><FONT face=Arial size=2></FONT>&nbsp;</P>
<P><FONT face=Arial size=2>Again, "?" are occuring only in UNIX machines, but 
works fine on Windows machines.</FONT></P>
<P><FONT face=Arial size=2></FONT>&nbsp;</P>
<P><FONT face=Arial size=2>I would appreciate any help.</FONT></P>
<P><FONT face=Arial size=2></FONT>&nbsp;</P>
<P><FONT face=Arial size=2>Thank you,</FONT></P>
<P><FONT face=Arial size=2></FONT>&nbsp;</P>
<P><FONT face=Arial size=2>pramodh.</FONT></P>
<P><FONT face=Arial size=2><FONT color=#3f7f5f size=2>&nbsp;</P>
<P><FONT color=#000000></FONT>&nbsp;</P></FONT></FONT></DIV></BODY></HTML>