Cygwin vi XML file encoding problem

Hi,

I have got a zip (binary) file transferred from MacOS (thus it has additional __MACOSX directory packed inside). On extracting this zip, there are few *.xml files available. When I opened this *.xml file in vim editor using Cygwin (on windows) the editor displayed [Incomplete last line][converted] in the bottom. I tried command file command on this xml file gave me the result "Big-endian UTF-16 Unicode character data".

After google search I came to know Mac's line terminator is carriage return '\r'. So windows needs '\r\n' (carriage return + line feed). So I manually added this \n using sed command

sed -i 's/$/\r\n/' test.xml

After that I am seeing the output as:

��^@<^@?^@x^@m^@l^@ ^@v^@e^@r^@s^@i^@o^@n^@=^@"^@1^@.^@0^@"^@ ^@e^@n^@c^@o^@d^@i^@n^@g^@=^@"^@U^@T^@F^@-^@8^@"^@?^@>^@^M

How to make this file a valid XML document?

What is your question for the forum?

My question to the forum is, how to convert this file to a valid XML document type (removing UTF-16 format and make it look like an ordinary file)

UTF-16 is a valid XML encoding for a document. Line terminators between elements are not part of the XML standard per se. So long as the document is well-formed, it is valid.

I suspect that what you want to do is to convert the document into a more viewable format i.e. UTF-8 If this is the case, have a look at the iconv man page.

I have attached the file here "sample.xml". Please have a look at it

As you have told I have used the 'iconv' command as follows

iconv -f UTF-16LE -t  UTF-8 < sample.xml

but not working as expected....

I need your help.