Hi Ravi,

The problem only happens to UTF-16 encoding, I am pretty sure my input
file (attached) is a valid UTF-16 XML.  I think this problem can be
reproduced on any UTF-16 XML, do you want try modify your code to UTF-16
and try out?

Thanks,
Benson.

-----Original Message-----
From: Ravi Varanasi [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 30, 2003 10:05 AM
To: [EMAIL PROTECTED]
Subject: RE: UTF-16 encoding problem







Hi,
       I do not see anything wrong in your code. I have the following
piece of code in my program, working perfectly fine since last couple
months. I am using UTF-8 though. I do NOT think the change in encoding
will make any difference, provided your file is in the format given in
setEncoding method.

What I suspect is, your input file is not UTF-16 encoded but, you are
setting the stream encoding as UTF-16. Check it out & let us know if
that fixes the problem. I use UniPad UTF editor to check encoding.

    try {
      InputSource ipSource = new InputSource();
      ipSource.setEncoding("UTF-8");
      ipSource.setByteStream( new FileInputStream( new File(inputFile) )
);
      parser.parse(ipSource);
      return true;
    } catch (SAXParseException e) {
      e.printStackTrace();
      return false;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }



Thanks,

Ravi Varanasi

408 517 7675 (Work)
408 394 3273 (Mobile)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

��<?xml version="1.0" encoding="UTF-16"?>

<Test>

	<Tag1>tag1</Tag1>

	<Tag2>tag2</Tag2>

</Test>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to