Reputation: 131
I am generating an xml file using C# code. Client uploads this xml on a url to validate its data but it fails to validate. Then client opened this downloaded xml file with notepad and saves this file (not save as) without making any changes then try again to validate against the url, it works fine. I am not able to understand the root cause of this issue. I have also tried some different ways to download the xml file but all fails.
Upvotes: 1
Views: 107
Reputation: 131
Found a solution. To resolve the issue, we wrote a line (Empty) and saved the file. It was the process that we followed manually to work with the file. We created the file but system did not consider it as a saved file. Some websites required the file to be saved properly in the system which is why I followed this approach. This is the sample code that can be used after creating the file.
StreamWriter sw = new StreamWriter(xmlPath, true);
sw.WriteLine();
sw.Close();
Upvotes: 0
Reputation: 10245
Cause
Then it must be something related to encoding.
Try this
Check the encoding in the files you saved using save and using save as. Use the encoding same as in the file you saved using save as.
Upvotes: 1