problem loading Unicode Xml file (no utf8)

I'm using Msxml2.DOMDocument and its method load() for loading xml documents.
it's work fine when loading asci files or UTF-8 files but when i want to load Unicode (16bit) files it want work.
I dont get any error message but my document seems empty with no nodes at all.

Here's my example xml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by fonis (fon) -->
<novosti>
     <naslov-strane>Novosti</naslov-strane>
     <opis-strane>Najnovije informacije</opis-strane>
     <novost id="new">
          <naslov>Primeri za kolokvijum</naslov>
          <datum>6.12.2002</datum>
          <tekst>
               Postavljeni primeri za vežbanje kolokvijuma iz Baza Podataka koji æe se održati u subotu u 08:00
          </tekst>
          <jos type="xml" href="literatura-primeri.xml"/>
     </novost>    
</novosti>


Can someone give me solution ?
LVL 7
cubrovicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BigRatCommented:
I assume you are loading a FILE not a stream from a web server. In this case :-

1) replace the encoding="utf-8" with encoding="ucs-2"
  OR
   omit it totally

2) Ensure that the file is stored in Unicode format.

   On WinNT/Win2K use NotePad to store the file in Unicode format.

Files stored in Unicode format (on Intel machines) are stored in Lendian format (=little end). This means that each 16-bit character is stored as two characters with the lower valued byte (=wchar MOD 65536) first (lower address) and the higher valued byte (=wchar DIV 65536) second (higher address). Additionally the start of the file is marked by two bytes FF FE

The parser will notice the first two bytes and will decode the rest of the file properly.

Incidentally, utf-8 files have the first three bytes as EF BB BF.

HTH
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cubrovicAuthor Commented:
Now it seems that working but i do it earlier (not ucs-2 but unicode) .I handle my xml files in xmlspy and it change it automaticly.Anyway if i have problems in future with it that will be new question with new points.
I thought that ms domDocument not working with 16 bit characters at all.
Thanks man.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.