Friday, October 30, 2009

FTP Issue: LPX-00200: could not convert from encoding UTF-8 to UCS2

I have an application that uploads XML files into an Oracle XML DB Repository. It was workinging succesfully on all documents except a few would fail...

My application would report the error:

FTPConnection closed

And in my Oracle logs I could see this error:

LPX-00200: could not convert from encoding UTF-8 to UCS2

I looked at the failing XML documents and noticed that they all had curly quotes in them. If I took them out, the file would upload.

The issue was that I needed to FTP as Binary and not as Text.

I was using the Java libarary FTPClient (it.sauronsoftware.ftp4j.FTPClient) and needed to set this command:


FTPClient .setType(FTPClient.TYPE_BINARY);

So just remember to use Binary mode when uploading to an Oracle XML DB Repository.

No comments: