From: Ryuji Hattori<ha...@hi...> - 2003-07-23 05:48:02
|
Hello all. I have been studying eXist programming by sample programs. Yesterday, I tried to store and retrieve XML Document written in Japanese. Storing with the XML-RPC way was succeeded but character Illegular conversion on whole Japanese character data occured. because in storing XML with the XML-RPC way encoding is set to UTF-8, I tried to convert encoding of retrieving String data form UTF-8 to default one(on my enviroment Shift_JIS ) by following code. XMLResource res = (XMLResource)col.getResource(docID); String str = new String(((String)res.getContent()).getBytes(),"UTF-8"); But somehow a little Illegular Strings still rest. Unicode may be a complete encoding set for Japanese Character data. there are some problems on using XML with Unicode, almost Illegular conversions I tried to do same things by using Embedded eXist server. all worked well about character encoding setting and in my hacking result, class org.exist.xmldb.LocalCollection does not seems to convert String's encoding. so I propose that org.exist.xmldb.CollectionImpl could select encoding in storing XML. For instance, in CollectionImpl.java by changing only one line, line 331, from: bdata = data.getBytes("UTF-8"); to : bdata = data.getBytes(encoding); you can set the encoding by the Collection#setProperty method. please comment. Thanks you. *********************************************** Ryuji Hattori in Hitz techinical lab (ha...@hi...) . |