Returning info from a Web Service
A support person from an organization indicated that their product wasn't able to consume my web service because it appeared I was returning ASCII encoded information, versus UTF-8 encoded information.
[WebMethod]
public string ReturnAll(){
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"some_dir\stockresults.xml");
XmlNodeList nodeList = xmlDoc.SelectNodes(@"/entries/Entry/Company|/entries/Entry/Symbol");
开发者_JAVA百科 //public static string value;
foreach (XmlNode org in nodeList)
{
value += org.OuterXml;
}
return value;
}
Any online references to what I'd need above to change it to the right encoding? Will I have to do something special in my method to re-encode the information before returning it?
Marco, UTF-8 is a default one.
Check this configuration option - http://msdn.microsoft.com/en-us/library/hy4kkhe0(v=VS.90).aspx
精彩评论