I have also faced the same problem. So while creating the Outputstream I have passed the Encoding format CP-1251 then it started working try to pass your encoding format. One more thing save your XMl file in Desktop and try to open it with uniread. If its looking corrupted then if your are using VM then save the Vm with your encoding format