Hi All,

In my Java application, I am inserting unicode japanese letters into some 
(sample data - ?????????
??????)of my fields. 

My marshaller works fine and inserts the correct data into the DB (which 
supports these characters).

However when i try to unmarshall the data it converts the unicode japanese 
characters into question marks ('?').

I am using jibx version 1.0.1

I have even taken the latest jibx version but i am getting the same results.

Can you please have to look and update us on this issue?

Please find below the code snippet which i used to marshall/unmarshall

Marshaller code

===============

public String convertBean2XML(DealJSPBean deal) throws BeanException{

//JIBX Marshalling

String xmlString = null;

ProductJSPBean productBean = deal.getProductJSPBean();

productBean.setExternalTradeId(String.valueOf(deal.getKey()));

try {

IBindingFactory bFactory = BindingDirectory.getFactory(productBean.getClass()); 

IMarshallingContext context = bFactory.createMarshallingContext();

StringWriter sw = new StringWriter();

context.marshalDocument(productBean, "UTF-8", Boolean.FALSE, sw);

xmlString = sw.getBuffer().toString(); 

EBlotterLog.LOG.debug(BeautifyXML.beautifyXML(sw.getBuffer().toString()));

} catch (Exception e) {

EBlotterLog.LOG.error("Failed to marshal ProductJSPBean using JiBX for deal 
id:"+deal.getKey() + e.getMessage(), e); 

throw new BeanException("Failed to marshal ProductJSPBean using JiBX for deal 
id:"+deal.getKey()

+ e.toString() + " : " + e.getMessage());

}

deal.getEBlotterDeal().setJibxXMLData(xmlString);

deal.getEBlotterDeal().synchronizeData(deal.getProductJSPBean());

return xmlString;

}

UnMarshaller code

===============

public ProductJSPBean convertXML2Bean(ProductJSPBean productBean, EBlotterDeal 
ebDeal) throws BeanException{

//JIBX Unmarshalling

String xmlData = ebDeal.getJibxXMLData();

ProductJSPBean updatedProductBean = null;

try { 

IBindingFactory bFactory = BindingDirectory.getFactory(productBean.getClass());

IUnmarshallingContext context = bFactory.createUnmarshallingContext(); 

InputStream is = new ByteArrayInputStream(xmlData.getBytes());

updatedProductBean = (ProductJSPBean)context.unmarshalDocument(is, "UTF-8");

} catch (Exception e) {

EBlotterLog.LOG.error("Failed to unmarshal XML using JiBX for deal id:" 
+ebDeal.getKey()+ e.getMessage(), e); 

throw new BeanException("Failed to unmarshal XML using JiBX for deal 
id:"+ebDeal.getKey()

+ e.toString() + " : " + e.getMessage()); 

}

//setExternalTradeId - for clone deals

updatedProductBean.setExternalTradeId(String.valueOf(ebDeal.getKey()));

return (ProductJSPBean)updatedProductBean;

}

Thanks,

Gaurav



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to