Is there any way to write a UCS-2 file from a Java application?
We have a utility, written in Java, which reads and exports Oracle data as UTF-8 files which can then be imported by PostgreSQL. We would like to expand the utility to support import by Microsoft DB products which apparently do not recognize UTF-8 and instead require UCS-2.
I think as long as there aren't any codepoints beyond the BMP (i.e., above 65535), UCS-2 is identical to UTF-16, so you might try that. Depending on how you process the files, a byte order mark may be necessary.
Ulf, Thanks for the reply. Is there anyway to know in advance what byte ordering would be used by MS SQL server? Or is this something that is typically specified on a per database basis?
Thanks again, -=bill
Joined: Mar 22, 2005
Byte order marks are only used in files, not databases. What you do need to worry about is the encoding the database uses -which by default is often ISO-8859 or even ANSI-, so you may have to change that.