Your problem is probably due to using a FileWriter without specifying
the encoding to the writer. The FileWriter is what actually converts the
characters to bytes, and it will use the default encoding for your
system. What you probably need to do is use a FileOutputStream instead,
in which case JiBX will handle the conversion to bytes. You could also
wrap a FileOutputStream in an OutputStreamWriter and specify the
encoding as UTF-8, but it'll probably be faster to just pass the
FileOutputStream directly to JiBX.
- Dennis
Bao Trang wrote:
Here is my marshalling/unmarshalling code. I think what is actually
written out is a question mark for each character. Do you mean what
do I see if I read the file with a hex reader? '3F' for each
character.
public void saveAs(File aFile) {
try {
IBindingFactory bfact = BindingDirectory.getFactory(Project.class);
FileWriter fw = new FileWriter(aFile);
IMarshallingContext mctx = bfact.createMarshallingContext();
mctx.setIndent(4);
mctx.marshalDocument(this, "UTF-8", null, fw);
....
}
public static Project readFrom(File f) throws JiBXException, IOException{
try {
IBindingFactory bfact = BindingDirectory.getFactory(Project.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
FileInputStream file = new FileInputStream(f);
Object obj = uctx.unmarshalDocument(file, null);
Project model = (Project) obj;
....
}
On Sat, 23 Oct 2004 13:10:31 -0700, Dennis Sosnoski <[EMAIL PROTECTED]> wrote:
How are you configuring your output, and what actual byte values are
written to the output document?
- Dennis
Bao Trang wrote:
In my Java application, I am inserting unicode greek letters into some
of my fields. When I try to marshall to XML, the output is a question
mark ('?') for each unicode char instead of the actual greek letter.
How do I fix this problem?
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users