Usually a byte order mark (BOM) is appended before any other text in the file. This BOM is used to tell the encoding of the following text.
XML files have this information in their starting tag.
If either of the above information is not present, then you have to make a guess.
thanks
Seshagiri