What happened to UnicodeLittle?

I have a piece of code that converts from one character encoding format to another, based upon arguments passed - using FileInputStream and FileOutputStream to read and write files.

It used to be that specifying an output encoding of UnicodeLittle would generate a file that contained Unicode Little Endian characters, readily legible in various text editors and other applications.

Now, with J2SE 5.0, it appears that specifying UnicodeLittle creates a file with UCN escape sequences (\u0000), which is fine for reading in Java but doesn't cut it for other applications.

Is anyone aware of a way to prevent the escape sequences from being applied?

I need to be able to write Unicode chars to a file as-is.

ConvertCharacterEncoding(File inputFile, String inputEncoding, File outputFile, String outputEncoding){

try{

BufferedReader br =new BufferedReader(setInputStreamReader(inputFile, inputEncoding));

OutputStreamWriter sw = setOutputStreamWriter(outputFile,outputEncoding);

String buffer = br.readLine();

while(buffer !=null){

lineCount++;

inCount += buffer.length();

outCount += buffer.length();

sw.write(buffer+"\r\n");

buffer = br.readLine();

}

sw.close();

}

catch(IOException ioe){

// exception handling goes here.

}

}

[1796 byte] By [nulltricka] at [2007-10-1 12:26:19]
# 1
> I need to be able to write Unicode chars to a file as-is.That would be the UTF16-LE charset, wouldn't it? Or was that what you actually meant by "Unicode Little"?
DrClapa at 2007-7-10 14:40:03 > top of Java-index,Desktop,I18N...
# 2

Nevermind, I'm going brain-dead. The input file I was using was not the one I was expecting.

In response to your question, I was using UnicodeLittle to ensure the use of a byte-order marker. UTF-16LE specifies that the BOM is optional, so converting from an ANSI doc usually left the BOM out.

Thanks for the quick reply.

nulltricka at 2007-7-10 14:40:03 > top of Java-index,Desktop,I18N...